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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Retrieve records from different tables

Author  Topic 

sagarpbora
Starting Member

12 Posts

Posted - 2007-10-09 : 12:05:33
Hi All,

I am having one query.
I am having one table in which the RECORD_NUMBER and TABLE_NAME is stored. This RECORD_NUMBER corresponds to the record in the TABLE_NAME. This table also has some fields like USER_ID, SESSION_ID to filter out unnecessary records.

What I need to do is, retrieve the RECORD_NUMBER and TABLE_NAME from this table (lets call it as TEMP) and Obtain the details about the respective record for thar RECORD_NUMBER from TABLE_NAME.

Its kind of complex query.
Is anybody having idea as to how to retreieve the details?

For the reference, this is the schema for the TEMP table

============================================================
RECORD_NUMBER | RECORD_TABLE_NAME | SESSION_ID | USER_ID
============================================================
12 | TEMP1 | XXX | 1
43 | TEMP1 | XXX | 1
10 | TEMP2 | XXX | 1
20 | TEMP3 | YYY | 2

& so on....

here, I need to retrieve the details about each of the RECORD_NUMBER from their respective RECORD_TABLE_NAME for the perticular SESSION_ID and USER_ID.

The details required are RECORD_NUMBER,RECORD_DESCRIPTION,RECORD_DATE,RECORD_AMOUNT

These details are common for all the tables.

Can anybody please give me idea about it?

Thanks a lot!

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-10-09 : 22:28:18
Do you have schema of related tables? Do they have column SESSION_ID and USER_ID?
Go to Top of Page
   

- Advertisement -