Board index » delphi » SQL - joining two tables

SQL - joining two tables

Hi,

I am no SQL expert by any means and I have a requirement which I am unsure
whether it can be handled using SQL.

I basically need to create a statement which concatenates the contents of
two files, the Invoice and Receipts files.  Both have a key of 'Code'.  I
basically just want to append the two tables together, no joins!  Can the
UNION clause be used to do this?

I have tried:

select * from invoice.db union select * from receipt.db

AND

select * from invoice.db union * from receipt.db

and the first comes up with 'Type mismatch' and the second with 'Invalid
expression'

Thanks in Advance

Alex

 

Re:SQL - joining two tables


Syntactically the first statement is correct.  Are you sure that both
tables have exactly the same structure?

Bill

(Sorry but TeamB cannot answer support questions received via email.)
(To send me email for any other reason remove .nospam from my address.)

Re:SQL - joining two tables


Quote

>select * from invoice.db union select * from receipt.db

Should work if the structures of the two tables are the same and you
are using 32bit BDE

--
Brian Bushay (TeamB)
Bbus...@DataGuidance.com

Other Threads