Hi guys I have one TDBgrid ... and I have two queries with the same fields *but* from different tables ... how do i join those two queries (TQueries) in one DBGrid (TDBgrid)
Thanks (Miguel)
Thanks (Miguel)
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
SELECT Field1, Field2, Field3 FROM Table1
UNION
SELECT FIeld4, FIeld5, Field6 FROM Table2[code]
You can even add an indicator to show WHERE the data came from in case you need to do some kind of edit or update:
[code]SELECT Field1, Field2, Field3, 'Table1' As Location FROM Table1
UNION
SELECT FIeld4, FIeld5, Field6, 'Table1' FROM Table2[code]
Leslie
Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
Essential reading for database developers:
[url=http://www.alphabetcitydataworks.com/fundamentals.htm]The Fundamentals of Relational Database Design[/url]
[url=http://www.devshed.com/c/a/MySQL/Understanding-SQL-Joins]Understanding SQL Joins[/url]