james438
05-02-2010, 07:29 PM
Here is a query I want to use. It works fine. I was rather surprised that it worked the first time I tried it.
(select ID, title from anime WHERE (lcase( concat(cast(ID as char), summary, IFNULL(image,''))) LIKE '%term%' ))
UNION
(select ID, title from misc WHERE (lcase( concat(cast(ID as char), summary)) LIKE '%term%' ))
UNION
(select ID, title from manga WHERE (lcase( concat(cast(ID as char), summary, IFNULL(image,''))) LIKE '%term%' ))
order by ID asc limit 10
As you can see I am sorting by ID here, but how can I sort this by table then by ID or even just by table?
(select ID, title from anime WHERE (lcase( concat(cast(ID as char), summary, IFNULL(image,''))) LIKE '%term%' ))
UNION
(select ID, title from misc WHERE (lcase( concat(cast(ID as char), summary)) LIKE '%term%' ))
UNION
(select ID, title from manga WHERE (lcase( concat(cast(ID as char), summary, IFNULL(image,''))) LIKE '%term%' ))
order by ID asc limit 10
As you can see I am sorting by ID here, but how can I sort this by table then by ID or even just by table?