Garayed.com  

Go Back   Garayed.com > mySQL
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-26-2006, 05:09 AM
Ralph
 
Posts: n/a
Default Why it's returning NULLs instead of 0?

Hi

This is my query:

SELECT
IF(ul.email='gggg@ggg.com',1,0) as email,
IF(ud.user_mobile_number=1234567890,1,0) as cellphone,
IF(ul.loginname='sdsd',1,0) as loginname
FROM
user_dossier_tbl as ud, user_login_tbl as ul
WHERE
(
ul.email='gggg@ggg.com' OR
user_mobile_number=1234567890 OR ul.loginname='sdsd'
) AND ud.user_id = ul.user_id

if there is no user in database with the same email or login name or
mobile number it should return:

email | cellphone | loginname
0 | 0 | 0

But it's returning:

email | cellphone | loginname
NULL | NULL | NULL

On the other hand if one of the columns have the same value (let's say
there is an email gggg@ggg.com in the database) the query returns:

email | cellphone | loginname
1 | 0 | 0

Why ?

--

Ralph
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:38 PM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.