Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2011
    Posts
    5

    Unanswered: Problem with Query

    Hello,

    Can anyone tell me what's wrong with this query? I'm getting the following error:

    "The select list of a grouped query contains at least one invalid expression"

    Code:
    "SELECT " + 
                        "CLOSEDCASH.HOST, " +
                        "CLOSEDCASH.HOSTSEQUENCE, " +
                        "CLOSEDCASH.MONEY, " +
                        "CLOSEDCASH.DATESTART, " +
                        "CLOSEDCASH.DATEEND, " +
                        "PAYMENTS.PAYMENT, " +
                        "SUM(PAYMENTS.TOTAL) AS TOTAL, TICKETS.TICKETID, RECEIPTS.DATENEW, PEOPLE.NAME " +
                        "FROM CLOSEDCASH, PAYMENTS, RECEIPTS, TICKETS, PEOPLE " +
                        "WHERE CLOSEDCASH.MONEY = RECEIPTS.MONEY AND PAYMENTS.RECEIPT = RECEIPTS.ID and RECEIPTS.ID=TICKETS.ID and TICKETS.PERSON = PEOPLE.ID AND ?(QBF_FILTER) " +
                        "GROUP BY CLOSEDCASH.HOST, CLOSEDCASH.HOSTSEQUENCE, CLOSEDCASH.MONEY, CLOSEDCASH.DATESTART, CLOSEDCASH.DATEEND, PAYMENTS.PAYMENT, TICKETS.TICKETID " +
                        "ORDER BY CLOSEDCASH.HOST, CLOSEDCASH.HOSTSEQUENCE, TICKETS.TICKETID");
    Thanks,
    Christian

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Have you tried building a string variable containing the query, and printing/viewing that string, prior to using the constructed string the query?
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by emotionuk View Post
    ...?(QBF_FILTER)
    my money is on this culprit
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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