Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
SandyK
Starting Member
9 Posts |
Posted - 2006-02-06 : 12:19:35
|
| Hello.I am new at SQL and am using SQL server express edition and im a bit stuck! I am using ASP.NET and C# in my website which is using sql database back end.String SQLroom = "SELECT DISTINCT RoomName FROM Room INNER JOIN RoomCalendar ON Room.RoomID = RoomCalendar.RoomID WHERE Capacity = '" + reqCapacity + "' " + " AND NOT ('" + newRoomEnd + "' <= roomStartDateTime OR '" + newRoomStart + "' >= roomEndDateTime) AND (OHP = '" + ohpYesNo + "' AND AV = '" + avYesNo + "') ";This is my SQL string... what it is trying to do is:find the roomwhere the capacity is the reqcapacity entered by userand the startdatetime and enddatetime entered by the user are not present in the table for that room capacityand then look at whether the user requires OHP or AV facilities, which are stored in the database as either yes or no values.The problem i am having is with the condition in the sql query... because the user may require an OHP and not AV, but then the room returned "`could" have AV facilities, as it wouldnt make a difference to them if it was there or not, basically, the yes condition has to be satisfied.Not sure whether i should be using AND, or OR? or a combination.Any ideas gratefully appreciated....Sandy |
|
|
|
|
|