If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
Hi there I need some help with a query within an Access 2000 database
I have a database to do with fuelcard which is called "BP+"
and i need to beable to run a Query to find out if any of the fuelcards
have been used 2 or more time on the same day,
The field with the date in is called "Date Time" and the field with the card number in is called "Card Number"
SELECT [Date Time], [Card Number], COUNT([Card Number]) AS num_used_per_day
FROM mytable
GROUP BY [Date Time], [Card Number]
HAVING (COUNT([Card Number]) > 1)
If Time Values are stored in your [Date Time] field you will have to eliminate these first for the query to work.
O.K., use this query to convert the date-time field on the fly
SELECT DateValue([Date Time]) AS myDate,[Card Number], Count([Card Number]) AS num_used_per_day
FROM mytable
GROUP BY DateValue([Date Time]), [Card Number]
HAVING (Count([Card Number])>1);
now this is getting more complex, you are looking into a mix of detailed data and aggregated data in one recordset which is not necessarily effective. If your task is to generate a report look at the "reports" designer in access. I'm sure you can easily work out a report that will display something like the following:
DATE | Card Number |Num_Used_Per_Day| Grand Total Of All The Products Added Together
Date Time | Products | Quantity | Net | Vat | Total
where the first line displays the aggregated values and the second line the details.