I want to be able to have a MYSQL statement which will determine to use a field if it is available. I am having problems getting this to work. I am trying to show a field if it is not null or set to zero.
An example set up:
Table 1: page [Fields: url, name, id]
Table 2: sub page [Fields: url, title, sub_id]
What I want to do is create a statement that determines if there is no sub_id, then it will skip that portion of the statement.
Example statement I've tried:
SELECT IF(sub_page.sub_id!=NULL,'',sub_page.sub_id), page.name,page.url, page.id FROM sub_page,page FROM Database;
obviously it isn't working, can anyone assist me with this issue? I really don't understand if this is possible or if it is purely boolean etc...
Business Identity and Web Development Services
An example set up:
Table 1: page [Fields: url, name, id]
Table 2: sub page [Fields: url, title, sub_id]
What I want to do is create a statement that determines if there is no sub_id, then it will skip that portion of the statement.
Example statement I've tried:
SELECT IF(sub_page.sub_id!=NULL,'',sub_page.sub_id), page.name,page.url, page.id FROM sub_page,page FROM Database;
obviously it isn't working, can anyone assist me with this issue? I really don't understand if this is possible or if it is purely boolean etc...
Business Identity and Web Development Services