Sebastian wrote:
i have a query with 3 union selects:
SELECT id, 'news' AS type, .... FROM news
UNION
SELECT id, 'faq' AS type, .... FROM faq
UNION
SELECT id, 'forum' AS type, .... FROM forum
which works just fine and selects everything from all 3 tables.. but say
i want to make a condition to only select from either 'faq' , 'news' or
'forum' how can i do this?
example, if a user visits a link suck as: page.php?cat=faq it will only
select from 'faq' .. is this possible to do right in the query? when
there is no ?cat= then all three selects run.
makes sense? i am stuck on this for a few days already.
thanks.
Why don't you do this in your app? If cat is set, issue the appropriate
single-table query, otherwise issue the union. Surely that would be
simpler than trying to build one multi-purpose query.
Michael
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]