Microsoft
Software
Hardware
Network
Question : Firebird Subquery
Good day
I would like to know how can I do the following subquery.
I have two tables and my data looks like this
Table A
Suite [PK]
Week [PK]
RoomStatus
Table B
Suite [FK]
Week [FK]
HomeRoom
example of data in table A
Suite Week RoomStatus
A 1 OPEN
B 2 OPEN
C 3 CLOSE
Example of data in table B
Suite Week HomeRoom
A 1 A
B 1 C
C 1 B
Now in my select I want to select everything from table B, but I want to get for each row the person actual RoomStatus from table a.
for example row 1 in table B, the guest HomeRoom = the Suite where he is currently in,
but row two The guest are in Room B but his HomeRoom is C ( I need now in this select his RoomStatus from table a)
If possible I want to use a subquery to perform this select because I need to perform a lot of additional sql once I got the data.
Thank you
Henry
Answer : Firebird Subquery
I believe this will be easier to achieve with a stored procedure, then you can do the addditonal sql on the server as well
select b.Suite, b.Week, b.HomeRoom, a.roomstatus from tableb b join tablea a on b.homeroom = a.suite and b.week = a.week
Random Solutions
Micorsoft Office Outlook has stopped working
Display OpenNetCf Signature control output on a desktop PC
I recently migrated from exchange server 2003 to exchange 2007, now I have a user who has a 3rd party pop email account he cannot send email from.
Backup a server to a non windows NAS (Buffalo - TeraStation Pro II 2.0TB Network Attached Storage)
Date/Time anomaly in CRM
Outlook, 2002, Identities
Use stored procedure as dataset in SSRS
Truncating Floats
unable to open, print, or save web based pdfs in IE7
EX2k7SP1 Rollup #4: Ended Prematurely