Hello Robert, > Hello experts, I've got a small problem with an sql query here that's got > me completely stuck. > > In my MySQL database I've got two tables here that have identical design, > e.g. > table 'detail' - columns sales-order, quantity, part-number, price, > date-sent > and > table 'archived' - columns sales-order, quantity, part-number, price, > date-sent. > > Detail is for 'active' orders, and Archived is for fulfilled orders. > > Now some genius here wants to see all the records that reference a > particular part number, > irrespective of whether in archived or detail. > > My current approach is to create a temporary table with all the suitable > records from > detail, add in any suitable records from archived, and then do a select * > query from this > temporary table, before dropping it. > > Now it strikes me that this isn't a very smart way to do this, and it's > probably achievable > via joins but, try as I might, I can't get the system to do it. Anyone got > any bright ideas/suggestions?
If the tables are identical then UNION may be what you're looking for: 6.4.1.2 UNION Syntax (MySQL >4.0). For every user "genius" who forgets to put something in the spec up-front, there's a computer guy who's smarter! Regards, =dn --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php