Quote
I have a select statement similar to the following:
select * from Column_A where ID = '01'
You don't select from Columns.
You select [one or more Columns] from Tables.
select ID
from Table_A
where ID = '01' ;
You
can run your query as a subquery:
select ID
from Table_B
where ID in
(
select ID
from Table_A
where ID = '01'
) ;
Or, if you're feeling a little more adventurous, you can do it with a Join:
select b.ID
from Table_B b
inner join Table_A a
on b.ID = a.ID
where a.ID = '01'
A couple of other things:
- Don't use "select *" in application code.
- If Table_A.ID and Table_B.ID are actually
numbers, then hold them in a numeric
Data Type, say
int. Chopping and changing between Data Types in your queries only serves to slow them down.