Saturday, 15 May 2010

mysql - Difficulty placing 2 WHERE's in SQL query -



mysql - Difficulty placing 2 WHERE's in SQL query -

what's wrong sql query?

it keeps returning next error @ where building_id=:building_id:

you have error in sql syntax; check manual corresponds mysql server version right syntax utilize near ':building_id , not exists ( select 1 ts_roompref ' @ line 5: select count(*) totalcount ts_room building_id=:building_id , not exists ( select 1 ts_roompref bring together ts_request on ts_roompref.request_id = ts_request.roompref_id , day_id = 1 , period_id = 1 ts_room.id = ts_roompref.room_id)

here code:

select count(*) totalcount ts_room building_id=:building_id , not exists ( select 1 ts_roompref bring together ts_request on ts_roompref.request_id = ts_request.roompref_id , day_id = 1 , period_id = 1 ts_room.id = ts_roompref.room_id)

i've got sql table here - http://sqlfiddle.com/#!2/30297/8

just drop sec where keyword.

this won't compile in sql fiddle because of :buildingid.

here's working example.

mysql

No comments:

Post a Comment