BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

using MySQL 3.23.58

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Jeff
Guest





PostPosted: Thu Jul 22, 2004 4:31 am    Post subject: using MySQL 3.23.58 Reply with quote



I have 2 tables...
one called rooms...
room#,bed which is a list of all existing rooms

another called residents
firstname, lastname, room#,bed, and so on.

If i have so many residents using room# and bed... how can I get a list of
room#,bed not being used yet?

I am currently doing this...
select * from room
where NOT((room="1" and Bed="A") or (Room="1" and Bed="B") ....... ) and so
on
Order by Room,Bed

Altho...v4.1 apparently supports this... I couldn't make it work either.
//dm.Rooms.Sql.Add('SELECT room.room,room.bed FROM room');
//dm.Rooms.Sql.Add('where (room.room,room.bed) NOT IN (SELECT room,bed
from Resident)');

what's the best way to do this with 3.23.58?

thanks

Jeff


Back to top
Jeff
Guest





PostPosted: Thu Jul 22, 2004 5:55 am    Post subject: Re: using MySQL 3.23.58 Reply with quote



I figured this out... with mysql v4.1.3... i can use the following

// select distinct room.room,room.bed,room.section from room,resident
// where NOT EXISTS(Select * from resident where room.room=resident.roomm
and room.bed=resident.bed)

and this seems to work. How would i duplicate this in 3.23.58 without using
sub-queries?
thanks..

Jeff


"Jeff" <jlabute (AT) shaw (DOT) ca> wrote

Quote:
I have 2 tables...
one called rooms...
room#,bed which is a list of all existing rooms

another called residents
firstname, lastname, room#,bed, and so on.

If i have so many residents using room# and bed... how can I get a list of
room#,bed not being used yet?

I am currently doing this...
select * from room
where NOT((room="1" and Bed="A") or (Room="1" and Bed="B") ....... ) and
so
on
Order by Room,Bed

Altho...v4.1 apparently supports this... I couldn't make it work either.
//dm.Rooms.Sql.Add('SELECT room.room,room.bed FROM room');
//dm.Rooms.Sql.Add('where (room.room,room.bed) NOT IN (SELECT room,bed
from Resident)');

what's the best way to do this with 3.23.58?

thanks

Jeff





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.