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 |
|
real_pearl
Posting Yak Master
106 Posts |
Posted - 2004-06-09 : 05:03:49
|
| Can I treat column's value(data) as column for a subquery. If yes HOW? |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2004-06-09 : 05:31:50
|
Do you mean as in:Select * from tablea where id in (select id from tableb) |
 |
|
|
real_pearl
Posting Yak Master
106 Posts |
Posted - 2004-06-09 : 06:04:15
|
| No I meanselect employeeid, first_name, section,'name' = (select employee.section from employee_personal_info)from employee where employee.section's value (data) is the column of employee_personal_info table. |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2004-06-09 : 06:19:51
|
| What's the link between employee and employee_personal_info tables??If it is employeeid then:-select e.employeeid, e.first_name, e.section, epi.section as namefrom employee e inner join employee_personal_info epi on epi.employeeid = e.employeeid |
 |
|
|
real_pearl
Posting Yak Master
106 Posts |
Posted - 2004-06-09 : 10:54:17
|
| Actually I want to use section's value as FIELD at runtime.IF section contains Accounts thenSELECT Accounts From Employee_Personal_Info |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2004-06-09 : 11:38:48
|
| Do you know how many value's you will have in section?If so you could use a case statement... |
 |
|
|
real_pearl
Posting Yak Master
106 Posts |
Posted - 2004-06-10 : 06:35:27
|
| No, I dont know the values of section, its the field of an input screen. so it keeps on increasing. |
 |
|
|
|
|
|