Forum Moderators: open
But what do I do if I want to get all the results in all fields but only from ones that contain something in the field named `week`.
I tried several things including "SELECT * FROM foo WHERE field LIKE `week` ORDER BY `week` DESC" but they all don't work right. What am I missing here?
By the way, the something in 'week' will be an array of numbers if that matters.
Thanks.
% = Matches any number of characters, even zero characters
_ = Matches exactly one character
Try:
SELECT * FROM foo WHERE field LIKE '%week%' ORDER BY field DESC"
" SELECT * FROM foo WHERE NOT ISNULL(week) AND week<>'' "
He told me that the [ AND week<>'' ] part was basically another way of saying week does not equal empty which I didn't previously know. So this will find any entries in the week field that are not empty. Week is a varchar field with NULL as the default. Whatever the explanation, the statement works. :)
Thank you both for your help.