PDA

View Full Version : query trouble [SOLVED :) ]


bazz
08-01-2008, 03:00 AM
Hi,

I have had this query working but today added a new table so I could have better normalisation. Despite my changes to take account of this, it throws an error.

query code

my $sth = $bookings_db_connect->prepare ("SELECT
RS.room_id,
RS.room_number,
RD.room_name,
group_concat(
concat_ws(
'/',
(RB.booking_id),
(RB.room_status),
(RB.check_in_date),
(RB.check_out_date)
) ORDER BY RB.check_in_date ASC
) as booking_data,
RD.business_id
FROM
tbl_rooms_stock RS, tbl_rooms_details RD
LEFT OUTER JOIN tbl_rooms_booked RB
ON RD.business_id = RB.business_id
AND RS.room_id = RD.room_id
AND RD.room_id = RB.room_id
AND RD.business_id = ?
AND RB.check_in_date >= ?
AND RB.check_out_date < ?
GROUP BY RS.room_id
ORDER BY RS.room_number
") or die "prepare statement failed: $DBI::errstr\n";

$sth->execute($business_id, $last_date, $first_date);




why is the yellowed line throwing an error.


solved: I stopped mixing my query styles and it works now.


bazz