query probations

imti

Member
Joined
Jun 15, 2005
Messages
7
Programming Experience
Beginner
as u can see at room no 109 there is no customer
and its on first floor
in my db design , room and floor are fixed for the hotel
so what wud be the query to insert customer in room no 109
along with RentDate,LeavingDate,Contract

pls pls let me know asap
thx in advance
imti

roomno cusid floor rentdate leavingdate contract
101 8 1 3000-03-03 00:00:00.000 4090-04-04 00:00:00.000 4
102 1 1 3000-02-02 00:00:00.000 3003-03-03 00:00:00.000 4
103 2 1 2000-02-02 00:00:00.000 3000-03-03 00:00:00.000 4
104 3 1 NULL NULL NULL
105 4 1 NULL NULL NULL
106 5 1 NULL NULL NULL
107 6 1 2000-02-13 00:00:00.000 NULL NULL
108 7 1 NULL NULL NULL
109 NULL 1 NULL NULL NULL
110 NULL 1 NULL NULL NULL
201 NULL 2 NULL NULL NULL
202 NULL 2 NULL NULL NULL
203 NULL 2 NULL NULL NULL
204 NULL 2 NULL NULL NULL
205 NULL 2 NULL NULL NULL
206 NULL 2 NULL NULL NULL
207 NULL 2 NULL NULL NULL
208 NULL 2 NULL NULL NULL
209 NULL 2 NULL NULL NULL
210 NULL 2 NULL NULL NULL
301 NULL 3 NULL NULL NULL
302 NULL 3 NULL NULL NULL
303 NULL 3 NULL NULL NULL
304 NULL 3 NULL NULL NULL
305 NULL 3 NULL NULL NULL
306 NULL 3 NULL NULL NULL
307 NULL 3 NULL NULL NULL
308 NULL 3 NULL NULL NULL
309 NULL 3 NULL NULL NULL
310 NULL 3 NULL NULL NULL
401 NULL 4 NULL NULL NULL
402 NULL 4 NULL NULL NULL
403 NULL 4 NULL NULL NULL
404 NULL 4 NULL NULL NULL
405 NULL 4 NULL NULL NULL
406 NULL 4 NULL NULL NULL
407 NULL 4 NULL NULL NULL
408 NULL 4 NULL NULL NULL
409 NULL 4 NULL NULL NULL
410 NULL 4 NULL NULL NULL
 
query help neded

select RoomNo,CusID from Room where Floor='1'
The result is
RoomNo Cusid
107 6
108 7
109 NULL
110 NULL
what wud be the query to show like this
RoomNo Cusid
109 NULL
110 NULL
thx in advance
imti
 
update TABLENAME set COLUMNNAME = VALUE, COLUMN2NAME = VALUE2 ... COLUMNXXXNAME = VALUEXXX where room = 109
 
ps, dont literally put dot dot dot (...) in your query, that is there to indicate you should put as many column = value in as needed
 
query help needed

In my Room Table i have following

RoomNo CusID Floor
105 4 1
106 NULL 1
110 NULL 1
201 9 2
202 NULL 2
by using this
select RoomNo from Room where Floor='1' AND CusID IS NULL
106 NULL
110 NULL
but my pont is i will use this query first
"Select distinct Floor from Room"
and show them in combo box
so based on selected floor how to show just the room no where CusID is NULL exactly on that floor

i try this code but error is given
"select RoomNo from Room where Floor =(" + Me.ComboBox1.SelectedItem + " )AND CusID IS NULL"

wud u pls help me out ??
 
dear guys

i succeded eventually what i was looking for but ur help was a big deal


"select RoomNo from Room where Floor='" & Me.ComboBox1.Text.ToString() & "' AND CusID IS NULL"

thx
imti
 
Dont write queries like that; its been wrong for about 15 years now. Take a read of the PQ link in my signature to find out why.

If you follow the DW2 link i recommended, you absolutely cannot succeed at writing a bad sql like this..

"donkey/water/drink" - anon
 
Back
Top