Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2003
    Posts
    100

    Arrow Unanswered: Simple SQL statement! Please help

    Hi I need to write a small query but I 'm not sure what the SQL is could some one help me!

    I have a table where a row is enter against each area where we get a new customer. What I need to do is write a SQL statement that will give me the number of the customer we have for each area in the first 6 month of this year , So I guess the query would go something liek this.

    SELECT count(*), AREA from customers where ENTERDATE is between '01-01-2004' and '01-07-2004' group by AREA;

    or somethng like that could some body, hepl me with the correct syntax, Thanks Ed

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi Nixies

    I believe something like this will count the number of each AreaID between the specified dates

    SELECT Count(AreaID) AS AreaCount
    FROM Customer
    WHERE ENTERDATE Between #1/1/2004# And #1/7/2004#
    GROUP BY AreaID

    HTH

    MTB

  3. #3
    Join Date
    Jul 2003
    Posts
    100
    Excellet thanks

    Quick question is it definately # I should be use=ign or has the forum alter your orginal post?

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    the "#" signs designate the string as a "short date" format. It should be used exactly as displayed.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Nop

    If you are writing the SQL in code then the # delimiting the date string is necessary (in both DAO & ADO).

    If you are using the query designer in Access and put the dates in a Criteria field row, then you do not use a #, but if you then look at the SQL view of the designed query you will see that access adds them.

    MTB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •