Click here to Skip to main content
15,511,378 members
Home / Discussions / Database
   

Database

 
GeneralRe: Manually increment a column value in SQL Server database through query when date < currentdate Pin
hilbiazhar9-Jun-14 22:30
hilbiazhar9-Jun-14 22:30 
AnswerRe: Manually increment a column value in SQL Server database through query when date < currentdate Pin
Chris Quinn9-Jun-14 22:04
Chris Quinn9-Jun-14 22:04 
AnswerRe: Manually increment a column value in SQL Server database through query when date < currentdate Pin
Mycroft Holmes9-Jun-14 23:57
professionalMycroft Holmes9-Jun-14 23:57 
GeneralRe: Manually increment a column value in SQL Server database through query when date < currentdate Pin
hilbiazhar10-Jun-14 4:00
hilbiazhar10-Jun-14 4:00 
GeneralRe: Manually increment a column value in SQL Server database through query when date < currentdate Pin
Chris Quinn10-Jun-14 5:02
Chris Quinn10-Jun-14 5:02 
QuestionRe: Manually increment a column value in SQL Server database through query when date < currentdate Pin
Eddy Vluggen10-Jun-14 6:28
professionalEddy Vluggen10-Jun-14 6:28 
AnswerRe: Manually increment a column value in SQL Server database through query when date < currentdate Pin
hilbiazhar10-Jun-14 6:49
hilbiazhar10-Jun-14 6:49 
QuestionRegarding case control statement in mysql Pin
aghori9-Jun-14 4:15
aghori9-Jun-14 4:15 
XML
/* 2:Display the patient_id, patient_name, phone number( +91-999-999-9999 format) , type_of_ailment .
    type of ailement is decided with the number of days stay in hospital.
    if stay <=5   ---- Minor
    if stay >5 and <=15 days ----Medium
    if stay >15 days ---- Major */


I have 2 tables room_allocation and patient_master where pid is the primary key of patient_master table and it also happens to be foreign key in room_allocation table.
1)Columns of patient_master table are(pid Varchar(5) Primary Key,
name Varchar(20) Not Null,
age int Not Null,
weight int Not Null,
gender Varchar(10) Not null,
address Varchar(50) Not Null,
phoneno varchar(10) Not Null,
disease Varchar(50) Not Null,
doctorid Varchar(5) Not Null,
constraint patient_master_doctorid_fk foreign key(doctorid) references doctor_master(doctorid))
2)columns of room_allocation table are
(room_no varchar(5),
pid varchar(5),
adm_date date,
release_date date,
constraint room_allocation_room_no_fk foreign key(room_no) references room_master(room_no),
constraint room_allocation_pid_fk foreign key(pid) references patient_master(pid))
--------------------------------------------------------------------------
I have written the following querry for above question but it gave a syantax error.
-------------------------------------------------------------------------
VB
select p.pid,p.name,concat('91-',p.phoneno),
case (release_date-adm_date)
when (release_date-adm_date)<=5 then 'minor'
when ((release_date-adm_date)>5 and (release_date-adm_date)<=15) then 'medium'
else 'Major'
end as 'type_ailment'
from patient_master p,room_allocation r
when (release_date-adm_date)<=5 then minor
when (release_date-adm_date)>5 and when (release_date-adm_date)<=15 then med
from patient_master p,room_allocation r
where p.pid=r.pid ;

AnswerRe: Regarding case control statement in mysql Pin
Wayne Gaylard9-Jun-14 4:22
professionalWayne Gaylard9-Jun-14 4:22 
GeneralRe: Regarding case control statement in mysql Pin
aghori9-Jun-14 4:34
aghori9-Jun-14 4:34 
AnswerRe: Regarding case control statement in mysql Pin
Jörgen Andersson9-Jun-14 4:25
professionalJörgen Andersson9-Jun-14 4:25 
GeneralRe: Regarding case control statement in mysql Pin
aghori9-Jun-14 4:37
aghori9-Jun-14 4:37 
Questiondatatype mapping Pin
Gilbert Consellado8-Jun-14 23:14
professionalGilbert Consellado8-Jun-14 23:14 
AnswerRe: datatype mapping Pin
Richard MacCutchan9-Jun-14 0:24
mveRichard MacCutchan9-Jun-14 0:24 
GeneralRe: datatype mapping Pin
Gilbert Consellado9-Jun-14 0:47
professionalGilbert Consellado9-Jun-14 0:47 
GeneralRe: datatype mapping Pin
Richard MacCutchan9-Jun-14 0:56
mveRichard MacCutchan9-Jun-14 0:56 
GeneralRe: datatype mapping Pin
Gilbert Consellado9-Jun-14 1:04
professionalGilbert Consellado9-Jun-14 1:04 
QuestionSQL Server and ADO.net IsolationLevel Pin
PIEBALDconsult6-Jun-14 17:10
professionalPIEBALDconsult6-Jun-14 17:10 
AnswerRe: SQL Server and ADO.net IsolationLevel Pin
Eddy Vluggen7-Jun-14 0:05
professionalEddy Vluggen7-Jun-14 0:05 
GeneralRe: SQL Server and ADO.net IsolationLevel Pin
PIEBALDconsult7-Jun-14 5:39
professionalPIEBALDconsult7-Jun-14 5:39 
QuestionHow to Sort this, Get Next Record ID when Many users inserting and different Districts Pin
Robymon6-Jun-14 0:03
Robymon6-Jun-14 0:03 
SuggestionRe: How to Sort this, Get Next Record ID when Many users inserting and different Districts Pin
GuyThiebaut6-Jun-14 1:55
professionalGuyThiebaut6-Jun-14 1:55 
GeneralRe: How to Sort this, Get Next Record ID when Many users inserting and different Districts Pin
Robymon6-Jun-14 3:19
Robymon6-Jun-14 3:19 
GeneralRe: How to Sort this, Get Next Record ID when Many users inserting and different Districts Pin
GuyThiebaut6-Jun-14 3:24
professionalGuyThiebaut6-Jun-14 3:24 
GeneralRe: How to Sort this, Get Next Record ID when Many users inserting and different Districts Pin
ZurdoDev6-Jun-14 3:49
professionalZurdoDev6-Jun-14 3:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.