ProblemHelpPlease Posted August 10, 2009 Share Posted August 10, 2009 When using UNION to combine several tables and then performing a search of the results, is there a way to know which table each result comes from? Link to comment Share on other sites More sharing options...
justsomeguy Posted August 10, 2009 Share Posted August 10, 2009 You would need to add another field to hold the table name, it's not going to do it automatically. e.g.SELECT field1, field2, field3, 'from table1' AS field4 FROM table1UNIONSELECT field1, field2, field3, 'from table2' AS field4 FROM table2 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.