Click here to Skip to main content
15,896,118 members
Home / Discussions / Database
   

Database

 
GeneralRe: error in sql statement Pin
asha_s4-May-08 4:12
asha_s4-May-08 4:12 
GeneralRe: error in sql statement Pin
Blue_Boy4-May-08 4:18
Blue_Boy4-May-08 4:18 
QuestionGroup summay in Sql report Pin
SamRST4-May-08 0:24
SamRST4-May-08 0:24 
AnswerRe: Group summay in Sql report Pin
Blue_Boy4-May-08 2:22
Blue_Boy4-May-08 2:22 
GeneralRe: Group summay in Sql report Pin
SamRST4-May-08 2:39
SamRST4-May-08 2:39 
GeneralRe: Group summay in Sql report Pin
Blue_Boy4-May-08 2:43
Blue_Boy4-May-08 2:43 
GeneralRe: Group summay in Sql report Pin
SamRST4-May-08 2:44
SamRST4-May-08 2:44 
QuestionSQL "Null" problem! Pin
Sebla2-May-08 22:09
Sebla2-May-08 22:09 
Hello everybody,

I try to show you the output but when I look from the preview part, the design is get out of order. I want to ask you how can I make the "null" parts gone? There are now empty spaces instead of nulls. But I want namesurname one after another without no spaces.

The output of this code is ;

MacType DAYS MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY
B(+) NIGHT BIRCAN AR
B(+) NIGHT BIRCAN AR
B(+) NIGHT HASAN DEM HASAN DEM
B(+) NIGHT HAVVA SUK HAVVA SUK
B(+) NIGHT HAVVA SUK
B(+) NIGHT MEHDIYE GÖR
B(+) NIGHT KEREM GOK
Here is my second table's view as I want.
What should I do to get this output?

MacType DAYS MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY
B(+) NIGHT BIRCAN AR BIRCAN AR HAVVA SUK HAVVA SUK
B(+) NIGHT HASAN DEM HASAN DEM MEHDIYE GÖR
B(+) NIGHT HAVVA SUK KEREM GOK

This my code;

select ISNULL(MAX(MachineType),''),
ISNULL(MAX(DAYS),''),
ISNULL(MAX(CASE WHEN DIALYSISDAY= 'MONDAY'THEN NAMESURNAME END),'') AS MONDAY,
ISNULL(MAX(CASE WHEN DIALYSISDAY= 'TUESDAY' THEN NAMESURNAME END),'') AS TUESDAY,
ISNULL(MAX(CASE WHEN DIALYSISDAY= 'WEDNESDAY' THEN NAMESURNAME END),'') AS WEDNESDAY,
ISNULL(MAX(CASE WHEN DIALYSISDAY= 'THURSDAY' THEN NAMESURNAME END),'') AS THURSDAY,
ISNULL(MAX(CASE WHEN DIALYSISDAY= 'FRIDAY' THEN NAMESURNAME END),'') AS FRIDAY,
ISNULL(MAX(CASE WHEN DIALYSISDAY= 'SATURDAY' THEN NAMESURNAME END),'') AS SATURDAY
from
(SELECT SICK.MACHINETYPE,SICK.NAMESURNAME ,
CASE WHEN SUBSTRING(DAYPERIOD, DATEPART(dw, SEANCE.SEANCEDATE), 1)= 'N' THEN 'NIGHT' ELSE '' END AS DAYS,
CASE WHEN SICK.MACHINETYPE= 1 THEN 'Negative-'
WHEN SICK.MACHINETYPE= 2 THEN 'B(+)'
WHEN SICK.MACHINETYPE= 3 THEN 'C(+)B(+)'
WHEN SICK.MACHINETYPE= 4 THEN 'C(+)' END AS MachineType,
CASE WHEN (DATEPART(dw, SEANCE.SEANCEDATE)) = 1 THEN 'MONDAY'
WHEN (DATEPART(dw, SEANCE.SEANCEDATE)) = 2 THEN 'TUESDAY'
WHEN (DATEPART(dw, SEANCE.SEANCEDATE)) = 3 THEN 'WEDNESDAY'
WHEN (DATEPART(dw, SEANCE.SEANCEDATE)) = 4 THEN 'THURSDAY'
WHEN (DATEPART(dw, SEANCE.SEANCEDATE)) = 5 THEN 'FRIDAY'
WHEN (DATEPART(dw, SEANCE.SEANCEDATE)) = 6 THEN 'SATURDAY' END AS DIALYSISDAY
FROM SEANCE,SICK
WHERE SUBSTRING(DAYPERIOD, DATEPART(dw, SEANCE.SEANCEDATE), 1)= 'N'
and SUBSTRING(SICK.EUCLID,1,5)= '18016'
AND SEANCEDATE BETWEEN '20080301' AND '20080307'
AND SICK.EUCLID=SEANCE.EUCLID )AS T
GROUP BY MachineType,
DAYS,
CASE WHEN DIALYSISDAY= 'MONDAY'THEN NAMESURNAME END,
CASE WHEN DIALYSISDAY= 'TUESDAY' THEN NAMESURNAME END,
CASE WHEN DIALYSISDAY= 'WEDNESDAY' THEN NAMESURNAME END,
CASE WHEN DIALYSISDAY= 'THURSDAY' THEN NAMESURNAME END,
CASE WHEN DIALYSISDAY= 'FRIDAY' THEN NAMESURNAME END,
CASE WHEN DIALYSISDAY= 'SATURDAY' THEN NAMESURNAME END
ORDER BY MachineType
AnswerRe: SQL "Null" problem! Pin
Adeel Chaudhry3-May-08 0:32
Adeel Chaudhry3-May-08 0:32 
QuestionSQL SERVER EXPRESS and NT AUTHORITY\NetworkService Pin
jerome_data2-May-08 13:39
jerome_data2-May-08 13:39 
AnswerRe: SQL SERVER EXPRESS and NT AUTHORITY\NetworkService Pin
Adeel Chaudhry3-May-08 0:33
Adeel Chaudhry3-May-08 0:33 
GeneralRe: SQL SERVER EXPRESS and NT AUTHORITY\NetworkService Pin
jerome_data3-May-08 3:38
jerome_data3-May-08 3:38 
GeneralRe: SQL SERVER EXPRESS and NT AUTHORITY\NetworkService Pin
Adeel Chaudhry3-May-08 10:25
Adeel Chaudhry3-May-08 10:25 
Questioni know jest the first later how can i write my sql Pin
asha_s2-May-08 10:04
asha_s2-May-08 10:04 
AnswerRe: i know jest the first later how can i write my sql Pin
leckey2-May-08 10:40
leckey2-May-08 10:40 
AnswerRe: Yes, .... Pin
Chris Meech2-May-08 10:50
Chris Meech2-May-08 10:50 
GeneralRe: Yes, .... Pin
asha_s2-May-08 23:40
asha_s2-May-08 23:40 
AnswerRe: i know jest the first later how can i write my sql Pin
Blue_Boy2-May-08 12:08
Blue_Boy2-May-08 12:08 
GeneralRe: i know jest the first later how can i write my sql Pin
asha_s2-May-08 23:40
asha_s2-May-08 23:40 
AnswerRe: i know jest the first later how can i write my sql Pin
Christian Graus2-May-08 16:15
protectorChristian Graus2-May-08 16:15 
GeneralRe: i know jest the first later how can i write my sql Pin
asha_s2-May-08 23:43
asha_s2-May-08 23:43 
GeneralRe: i know jest the first later how can i write my sql Pin
Adeel Chaudhry3-May-08 0:37
Adeel Chaudhry3-May-08 0:37 
GeneralRe: i know jest the first later how can i write my sql Pin
Christian Graus3-May-08 1:41
protectorChristian Graus3-May-08 1:41 
GeneralRe: i know jest the first later how can i write my sql Pin
Adeel Chaudhry3-May-08 0:34
Adeel Chaudhry3-May-08 0:34 
QuestionAdventurework Database Downloading problem Pin
ManiMughal2-May-08 9:09
ManiMughal2-May-08 9:09 

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.