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
 Query Between Dates

Author  Topic 

pottspotts
Starting Member

9 Posts

Posted - 2007-10-23 : 01:52:28
I have two tables: Sales, Consigners

The Sales table includes: date, description, price, consigner
The Consignment table includes: lastday, consigner

I need a query that will display all rows in Sales assuming Sales.date is less than or equal to Consigner.lastday. The .consigner fields need to be joined.

I have this and it isn't working:

SELECT DISTINCT [Sales Data].co1, [Sales Data].amount, [Sales Data].description, Consignment_Data.date AS Expr1
FROM Consignment_Data INNER JOIN [Sales Data] ON Consignment_Data.co1 = [Sales Data].co1
WHERE ((([Sales_Data].[date])=[Consignment_Data].[date]));





This is for MS Access 2003. Can anyone help me? I would appreciate some advice, as my code isn't working at all

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-23 : 02:11:04
All column names in your query NOT found in any referenced table or view are treated as parameters.




E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Bit Wrangler
Starting Member

9 Posts

Posted - 2007-11-02 : 08:34:30
For starters, you have WHERE [Sales_Data].[date])=[Consignment_Data].[date] and you're looking for Sales.date less than or equal to Consigner.lastday. Change your WHERE clause to [Sales_Data].[date]<=[Consignment_Data].[date].
Go to Top of Page
   

- Advertisement -