Is it possible to combine the two SQL Join Statement?
June 29, 2009 - 9:28 pm
COA Table (Fields: ACode, Title, Type)
AP Table (Fields: ACode, Debit, Credit, Date)
Example:
COA: 1, Cash In Bank, Bank Statement
2, Labor Cost, Income Statement
and so on
AP: 1, 0,250, Jan 1
2,300,0,Jan 5
I need to list down the COA with corresponding SUM of Debit/Credit and Union the COA with with corresponding SUM of Debit/Credit starting frm Jan 1 to date.
need help, thanks
The short answer is yes. The longer answer is that your examples make little sense.
But, doing a UNION query between your two result sets is doable in most SQLs (definitely T-SQL), you just have to make sure the result sets you are UNIONing have the same columns.
June 30th, 2009 at 2:57 am
The short answer is yes. The longer answer is that your examples make little sense.
But, doing a UNION query between your two result sets is doable in most SQLs (definitely T-SQL), you just have to make sure the result sets you are UNIONing have the same columns.
References :
June 30th, 2009 at 3:22 am
The sql joints are…Compliants Joins:
1. Cross joins
2. Natural joins
References :
June 30th, 2009 at 3:52 am
select *, (select sum(debit/credit) from AP where ACode=COA.ACode),
(select sum(debit/credit) from AP where ACode=COA.ACode and date>'20080101')
from COA
References :
http://www.sql-ex.ru/