Results 1 to 4 of 4

Thread: SQL in Access

  1. #1
    Join Date
    May 2006
    Posts
    9

    Question Unanswered: SQL in Access

    Following query will return the sum of total cost starting from telephone number 94112 and calls dialed on 02 May 2006.

    SELECT SUM(Calls.Cost)
    FROM Calls
    WHERE Calls.Telephone Like '94112*' And Calls.Detail Like '02 May 2006*'


    In the meantime I want to add an additional filter as I need only the cost of which one call cost greater then 0.50 cents: For eg: my table looks likes below

    Detail Telephone Number Duration Cost
    02 May 2006 941121525252 01:01 0.5
    02 May 2006 941121525252 01:01 0.3


    The following query will bring the output only the cost of which one call exceed 0.5…I mean call costs greater than then 0.50

    SELECT Calls.Cost
    FROM Calls
    WHERE Calls.Cost >'0.5'

    But I need one query to get the below result, I mean

    Sum of Cost
    In which telephone numbers starting from 94112 (Like 94112) AND
    Call details (Calls dialed on) is 02 May 2006.

    Pls advise.

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    SELECT SUM(Calls.Cost)
    FROM Calls
    WHERE Calls.Telephone Like '94112*' And Calls.Detail Like '02 May 2006*' AND Calls.Cost > 0.5

    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  3. #3
    Join Date
    May 2006
    Posts
    9

    Red face It doesnt work

    I did try that but I am getting an error message as ‘Data type mismatch in criteria expression’

    Therefore is there anything wrong with the SQL or any alternative ways to execute the same report?

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by toplist
    I did try that but I am getting an error message as ‘Data type mismatch in criteria expression’

    Therefore is there anything wrong with the SQL or any alternative ways to execute the same report?
    Verify your types in the query and use appropriate typing ... Specifically, is that a date field you're trying to pattern match against?
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

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