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
 SQL-How to query database with multiple queries

Author  Topic 

fdtoo
Starting Member

28 Posts

Posted - 2004-09-19 : 05:33:02

I have the following fieldname in an Access_Table:

Field 1 = Cust_ID (Primary key)
Field 2 = Date
Field 3 = Description
Field 4 = Inv_No
Field 5 = Amount

My SQL Input syntax are:

"Select distinct Cust_ID,Date,Description,Inv_No,Amount from Access_Table WHERE Date <Now()-30 And Date >Now()-60"

It failed to generate the result I want,anyway

My "Required" Output is:

Cust_ID Date Description Inv_No >30DYS >60DYS
8000 21/05/2004 PC RAM 00120 200
8000 26/06/2004 Modem 00121 180
---------------------------------------------------------------
Total: 180 200
---------------------------------------------------------------

8001 22/04/2004 Cable 05510 50
8001 23/05/2004 HD 05520 210
---------------------------------------------------------------
Total: 260
---------------------------------------------------------------
Grand Total: 180 460


can anyone help? Thanks
From:Cady Steldyn

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-09-19 : 19:26:39
First of all, replace your
Date <Now()-30
with
Date < DateAdd("d",-30,Now)

If it still doesn't work, post some sample data for us to work with.
Go to Top of Page
   

- Advertisement -