Thanks for the reply. There is a slight difference in what I need from the "IFNULL" function. It will only return the specified value if the column is null on a row that actually exists. I am needing a function that will return the specified value if the row does NOT exist. Any other ideas?
SELECT nameColumn from theDatabase WHERE rowID = 5; (when no row has ID "5") result --> empty set (I want a value like '0' or something) Thanks again! -John on 10/10/04 8:12 PM, liang lei at [EMAIL PROTECTED] wrote: > --- John Mistler <[EMAIL PROTECTED]> >> Is there a way to force SOME value to be returned >> from a SELECT query when >> the result is empty set? For instance: >> >> SELECT nameColumn from theDatabase WHERE rowID = 5; >> >> (when no row has ID "5") >> >> result --> empty set >> >> I would like for it to return some value, such as '' >> or 0 . . . >> >> Thanks, >> >> John >> >> >> -- >> MySQL General Mailing List >> For list archives: http://lists.mysql.com/mysql >> To unsubscribe: >> > http://lists.mysql.com/[EMAIL PROTECTED] >> >> > > select ifnull(column,'0') from table > > _________________________________________________________ > Do You Yahoo!? > 150??MP3???????????? > http://music.yisou.com/ > ??????????????????? > http://image.yisou.com > 1G??1000??????????? > http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]