Misa wrote:

How can I receive a TRUE or FALSE result?

Example:

SELECT `name`, `description` FROM `table1`;

I don't want to show the description cause they're big. I only want to show the name and a result of TRUE or FALSE. TRUE if description is not empty or not null, FALSE if empty or null.

I'm using MySQL 4.0.

Thanks. :-)

select name, not(isnull(description)) from table1;

This will only work if the field is actually NULL, which is different from having an empty string ( '' ) in it. If you instead have empty strings, you'd have to do something like:

select name, if(length(description),1,0) from table1;

Otherwise if you want the *string* TRUE or FALSE in the results, you'd replace the 1 and 0 with 'TRUE' and 'FALSE'. Or for the original example, you'd have to add an if() function around the not() function and put your TRUE and FALSE strings in there.

Dan

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: http://www.nusconsulting.com.au

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to