Subject | RE: [firebird-support] join multiple tables |
---|---|
Author | Sasha Matijasic |
Post date | 2008-01-20T11:57:20Z |
> hi i have 2 tables sales_invoice and credit_memo. is it possible toHi, it is most certainly possible to join two tables, but in order for
> join this 2 tables so it looks like
>
> Type Customer Doc No. Amount
> ----------------------------------------------
> Invoice A 1 $10000
> Credit Memo B 1 $15000
>
someone to help you, you should provide more info about your tables, most
importantly how are those tables to be joined.
The basic pattern is this:
select col1, col2 [, coln]
from table1
[left] join table2 on table1.primary_key =
table2.foreign_key_referencing_table1_pk
Although, looking at your result example, it looks like you want to union
those tables which can be achieved like this:
select [columns] from sales_invoices
union all
select [columns] from credit_memo
Your question was unclear to me, but if you provide your table structures
more precisely, I might be able to give you better answer.
I hope this helps anyway or at least points you to right direction
Sasha