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.

 
Go Back  dBforums > Database Server Software > PostgreSQL > Problem with Query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-18-11, 08:38
emotionuk emotionuk is offline
Registered User
 
Join Date: Nov 2011
Posts: 2
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
Reply With Quote
  #2 (permalink)  
Old 12-22-11, 16:16
loquin loquin is offline
Super Moderator
 
Join Date: Jun 2004
Location: Arizona, USA
Posts: 1,797
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

Reply With Quote
  #3 (permalink)  
Old 12-22-11, 17:20
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,540
Quote:
Originally Posted by emotionuk View Post
...?(QBF_FILTER)
my money is on this culprit
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On