Click here to Skip to main content
15,887,812 members
Home / Discussions / Database
   

Database

 
Questionhow to join all three query results to one in mysql Pin
sr15930-Apr-14 23:01
sr15930-Apr-14 23:01 
hi

i have written 3 different select query in mysql based on yesterday,today, tommorow dates to get the birthday details as follows
select concat(name,', ',title) as 'Yesterday 30-04-2014' from personal_details where DOB=curdate() - interval 1 day
select concat(name,', ',title) as 'Today 01-05-2014' from personal_details where DOB=DATE(NOW())
select concat(name,', ',title) as 'Tommorow 02-05-2014' from personal_details where DOB=curdate() + interval 1 day

how to join all 3 query results to one, i need to show as below
Yesterday Today Tomorrow
aaaa gggg nnnnn
bbbb hhhhh mmmm
dddd jjjjj
eeee
ffff


How to achieve this, i am not able to do.

If i tried with join there it wont match any condition and will not work because in each query result i will get unique values.
I tried with another query by putting as below

select a.* from (select CASE DOB WHEN (curdate() - interval 1 day) THEN concat(name,', ',title) ELSE '' END AS 'Yesterday', CASE DOB WHEN (DATE(NOW())) THEN concat(name,', ',title) ELSE '' END AS 'Today',CASE DOB WHEN (curdate() + interval 1 day) THEN concat(name,', ',title) ELSE '' END AS 'Tomorrow' from personal_details ) as a where a.Yesterday IS NOT NULL and a.Today IS NOT NULL and a.Tomorrow IS NOT NULL

It is showing the result like in all the three column some rows will be null

I dont want null values in any column. i want out as above.

How to achieve this. If anybody knows please reply me.

Thanks in advance.
AnswerRe: how to join all three query results to one in mysql Pin
Simon_Whale30-Apr-14 23:12
Simon_Whale30-Apr-14 23:12 
GeneralRe: how to join all three query results to one in mysql Pin
sr1591-May-14 5:34
sr1591-May-14 5:34 
Questionhow to fetch a table column of same name of more than 4 different database in sql server 2008r2??? Pin
Member 1078495429-Apr-14 20:24
Member 1078495429-Apr-14 20:24 
AnswerRe: how to fetch a table column of same name of more than 4 different database in sql server 2008r2??? Pin
Kornfeld Eliyahu Peter29-Apr-14 21:22
professionalKornfeld Eliyahu Peter29-Apr-14 21:22 
QuestionLoading large amount of data with unacceptable time Pin
Amr Muhammed27-Apr-14 10:30
Amr Muhammed27-Apr-14 10:30 
AnswerRe: Loading large amount of data with unacceptable time Pin
David O'Neil27-Apr-14 11:17
professionalDavid O'Neil27-Apr-14 11:17 
GeneralRe: Loading large amount of data with unacceptable time Pin
Amr Muhammed27-Apr-14 11:32
Amr Muhammed27-Apr-14 11:32 
GeneralRe: Loading large amount of data with unacceptable time Pin
David O'Neil27-Apr-14 11:38
professionalDavid O'Neil27-Apr-14 11:38 
AnswerRe: Loading large amount of data with unacceptable time Pin
Mycroft Holmes27-Apr-14 12:54
professionalMycroft Holmes27-Apr-14 12:54 
GeneralRe: Loading large amount of data with unacceptable time Pin
Amr Muhammed27-Apr-14 19:28
Amr Muhammed27-Apr-14 19:28 
GeneralRe: Loading large amount of data with unacceptable time Pin
Mycroft Holmes27-Apr-14 21:54
professionalMycroft Holmes27-Apr-14 21:54 
GeneralRe: Loading large amount of data with unacceptable time Pin
Amr Muhammed29-Apr-14 13:11
Amr Muhammed29-Apr-14 13:11 
AnswerRe: Loading large amount of data with unacceptable time Pin
V.28-Apr-14 0:01
professionalV.28-Apr-14 0:01 
GeneralRe: Loading large amount of data with unacceptable time Pin
Amr Muhammed29-Apr-14 13:06
Amr Muhammed29-Apr-14 13:06 
GeneralRe: Loading large amount of data with unacceptable time Pin
V.30-Apr-14 23:45
professionalV.30-Apr-14 23:45 
AnswerRe: Loading large amount of data with unacceptable time Pin
jschell28-Apr-14 8:16
jschell28-Apr-14 8:16 
GeneralRe: Loading large amount of data with unacceptable time Pin
Amr Muhammed29-Apr-14 13:00
Amr Muhammed29-Apr-14 13:00 
GeneralRe: Loading large amount of data with unacceptable time Pin
Mycroft Holmes29-Apr-14 13:06
professionalMycroft Holmes29-Apr-14 13:06 
GeneralRe: Loading large amount of data with unacceptable time Pin
Amr Muhammed29-Apr-14 13:12
Amr Muhammed29-Apr-14 13:12 
GeneralRe: Loading large amount of data with unacceptable time Pin
David O'Neil29-Apr-14 13:22
professionalDavid O'Neil29-Apr-14 13:22 
GeneralRe: Loading large amount of data with unacceptable time Pin
jschell29-Apr-14 14:33
jschell29-Apr-14 14:33 
QuestionHow do I pass parameters from one jquery tab to another? Pin
samflex25-Apr-14 17:32
samflex25-Apr-14 17:32 
AnswerRe: How do I pass parameters from one jquery tab to another? Pin
Kornfeld Eliyahu Peter26-Apr-14 23:42
professionalKornfeld Eliyahu Peter26-Apr-14 23:42 
GeneralRe: How do I pass parameters from one jquery tab to another? Pin
samflex27-Apr-14 5:53
samflex27-Apr-14 5:53 

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.