This is a MySQL database question. I have a table of classes (school classes) which gets archived occasionally. So, I need to search both the active table and the archived table for a specific class. My query looks like this:
( SELECT * FROM class WHERE class_id = '22' )
UNION
( SELECT * FROM class_archive WHERE class_id = '22' )
Both SELECT statements work indpendently, but the UNION of the two does not. I get:
1064 - You have an error in your SQL near
'( SELECT * FROM class WHERE class_id = '22' ) UNION
( SELECT * FROM class_ar' at line1
I'm running MySQL 5.0.37 on Windows XP. I can't see anything wrong with this query.