SQL statement invalid. Unknown Column
12 January, 2012
Hi there,
I am trying to edit a SQL view, but I keep receiving an error every time I try to validate the SQL or move on to the next step.
The SQL in question is:
SELECT TRB_TRIP_BOOKING_ID as 'Trip Booking ID', TRB_TRAVEL_DATE as 'Travel Date', TRB_PRICE AS 'Trip Price', MAX(TBS_BOOKED_PASSENGERS) as 'Booked Passengers',MAX(ifnull(TBS_BOARDED_PASSENGERS,0)) as 'Boarded Passengers'
FROM trb_table
INNER JOIN tbs_table
ON TRB_TRIP_BOOKING_ID = TBS_TRIP_BOOKING_ID
AND (TRB_MEMBER_PASSPORT_COMPONENT_ID IS NULL OR TRB_MEMBER_PASSPORT_COMPONENT_ID = 0)
AND TRB_STATUS = 'CO'
GROUP BY
TRB_TRIP_BOOKING_ID,
TRB_TRAVEL_DATE,
TRB_PRICE
I have run the exact query on the database directly and it works perfectly fine.
The error message I get is:
SQL statement is invalid.
The error message returned from the database was:
Unknown column 'TRB_TRIP_BOOKING_ID' in 'field list'
I would appreciate some help on this matter.
Thank you.
I am trying to edit a SQL view, but I keep receiving an error every time I try to validate the SQL or move on to the next step.
The SQL in question is:
SELECT TRB_TRIP_BOOKING_ID as 'Trip Booking ID', TRB_TRAVEL_DATE as 'Travel Date', TRB_PRICE AS 'Trip Price', MAX(TBS_BOOKED_PASSENGERS) as 'Booked Passengers',MAX(ifnull(TBS_BOARDED_PASSENGERS,0)) as 'Boarded Passengers'
FROM trb_table
INNER JOIN tbs_table
ON TRB_TRIP_BOOKING_ID = TBS_TRIP_BOOKING_ID
AND (TRB_MEMBER_PASSPORT_COMPONENT_ID IS NULL OR TRB_MEMBER_PASSPORT_COMPONENT_ID = 0)
AND TRB_STATUS = 'CO'
GROUP BY
TRB_TRIP_BOOKING_ID,
TRB_TRAVEL_DATE,
TRB_PRICE
I have run the exact query on the database directly and it works perfectly fine.
The error message I get is:
SQL statement is invalid.
The error message returned from the database was:
Unknown column 'TRB_TRIP_BOOKING_ID' in 'field list'
I would appreciate some help on this matter.
Thank you.
Hi,
I'm not sure why the query is working when you're running it against your DB as it doesn't look like you are specifying the tables in your query .
E.g.
SELECT.TRB_TRIP_BOOKING_ID as 'Trip Booking ID', .TRB_TRAVEL_DATE....
I'm not sure why the query is working when you're running it against your DB as it doesn't look like you are specifying the tables in your query .
E.g.
SELECT