Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Join Query with Insert

Author  Topic 

skaswani
Starting Member

24 Posts

Posted - 2008-07-06 : 05:40:29
Dear Friends

can u hlp me to re-write this query?

SELECT scn.TransactionDate, Count(*) AS Expr2
FROM scn where BranchCode is null
GROUP BY scn.TransactionDate;
UNION SELECT scn.TransactionDate, Count(*) AS Expr1
FROM scn where BranchCode is not null
GROUP BY scn.TransactionDate;



what i want to do is, i want a TransactionDate and Expr2 as UnPaid_Count and Expr1 as Paid_Count into a Table name Status


but one more thing.. it should not insert DUPLICATE RECORDs

Database = Access 2000 with VB 6

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2008-07-07 : 03:17:28
Have a look at the CASE clause....CASE BRANCHCODE WHEN NULL xxxx ELSE xxxx END
There are several examples of this sort of maths on this site.
Go to Top of Page
   

- Advertisement -