When requesting assistance with SQL, please post (simplified) table schemas
(CREATE TABLEs), sample data (INSERTs) and the results you want using the
Narratives are frequently ambiguous.
My best guess at what you want is something like:
create table TableA
a1 int NOT NULL primary key,
a2 char (1)
create table TableB
b1 int NOT NULL primary key,
b2 char (1)
insert into TableA values (1, 'a')
insert into TableA values (2, 'b')
insert into TableB values (1, 'c')
insert into TableB values (2, 'd')
from TableA as a
join TableB as b
on (a.a1 = b.b1)
If this is not want you are looking for, then please post as requested
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.
how to select different column from table A according to table B
select (select formular from TableB where comid='pg01')
from tableA where markupid=1
the tableA column will be decided by tableB select result. How to do that?