Login    Forum    Search    FAQ   Blog

Board index » Server Side Development » PHP




 Page 1 of 1 [ 3 posts ] 



Author Message
 Post subject: Joinin problem'
 Post Posted: Thu Nov 12, 2009 10:37 pm 
Offline

Joined: Sat Feb 21, 2009 12:39 pm
Posts: 50
Hi,

i m havin a join query 4 two tables.i wold like to display a field as
null if it was NULL.how could i do that?Also i m havin a where condition.
what if i need to select value 4m the first table even if da where
condition wouldn't satisfied.

_________________
Hard work never killed anybody, but why take a chance?


Top 
 Post subject: Re: Joinin problem'
 Post Posted: Thu Nov 12, 2009 10:38 pm 
Offline

Joined: Sat Feb 21, 2009 11:06 am
Posts: 1794
download toad it was free and have a query builder dat makes those
complex statmnts!!!


Top 
 Post subject: Re: Joinin problem'
 Post Posted: Thu Nov 12, 2009 10:38 pm 
Offline

Joined: Sat Feb 21, 2009 1:08 pm
Posts: 549
Hi

For da very first part, try somethin like this:-

Code:
Code:
SELECT *, if(b.id IS NULL, 'null',b.id)
FROM table1 a
LEFT OUTER JOIN table2 b
ON a.id = b.PageId


Not sure wat you want wid a WHERE clause dat was ignored.

All the best


Top 
Display posts from previous:  Sort by  
 
 Page 1 of 1 [ 3 posts ] 




Board index » Server Side Development » PHP


Who is online

Users browsing this forum: No registered users and 2 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron