Re: How to count same value as 1 in a query

Tech-Archive recommends: Speed Up your PC by fixing your registry



Michel, I was able to understand what you were trying to explain to me in SQL
code by reading the data out of SQL View (sorry, I'm a newb). Still, the
product of your data gives me the same as creating a count of products, but
what I need is the amount of days that this product was actually bought in,
disregarding the actual amount of products sold.

"Michel Walsh" wrote:

Make a query that will group by product AND by date, next, make a second
query that will be based on the previous query, but this last query will
group by product and count the number of records:


q1:
SELECT product, theDate
FROM somewhere
GROUP BY product, theDate


q2:
SELECT product, COUNT(*)
FROM q1
GROUP BY product



Vanderghast, Access MVP


"Fernando@Sartorius" <Fernando@Sartorius@discussions.microsoft.com> wrote in
message news:457FC0FE-9002-475D-824F-BCA80469D930@xxxxxxxxxxxxxxxx
Good day to all who read this post. I am in need of assistance. I am
trying
to create a query in which I need to state that This X Material was
purchased
Y amount of times during a year, but if the products was bought multiple
days, I want the query to count all those values from that same date as 1.

These are my Fields:
Mat 1st Date Purch. Last Day Purch. # of times bought # of days
product was bought.

Can anyone provide me some feedback? Thanks in advanced.



.



Relevant Pages

  • Re: Ask for a query
    ... I want a query that let ... Customer_ID 1 bought for the first time in September 2003, ... How do I write that in SQL? ... MON CUSTID ...
    (comp.databases.oracle.server)
  • Re: Count Unique Values
    ... Michel, you are absolutely right about this ng being a ... >You also guess right in that SQL allows to easily perform ... >away from Joe Celko's books, ... Your query worked. ...
    (microsoft.public.access.queries)
  • Re: query unique count for field
    ... Thanks Michel. ... I managed to do it all without using SQL. ... > Query q1: ... > where table Iotas has a single field, iota, with values from 1 to nnn, nnn ...
    (microsoft.public.access.queries)
  • Re: DBMS and lisp, etc.
    ... Naively implemented with SQL, again for 10 ... (1 query for the initial orders, 1 query for each order for its ... soon as you upgrade to the SQL database. ... (eq (order-customer orderA) ...
    (comp.lang.lisp)
  • Re: Populating a list -- table structure?
    ... I had made a report already and figured out about adding the ... your responce below, but thanks to your help with SQL, I was able to get the ... It takes a summary from a select query and gives the ... KitID, long integer ...
    (microsoft.public.access.forms)