Click here to Skip to main content
15,891,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,

my below query is working well..
SQL
SELECT chln_prefix,chln_no
FROM PC
except
SELECT prefix,doc_no
FROM PB

but I want to fire such below query. How can I use noting in place of except?
Please help me.
SQL
SELECT chln_prefix,chln_no,chln_name
FROM PC
except
SELECT prefix,doc_no
FROM PB

Thank you
Posted
Updated 9-Sep-10 3:56am
v2

1 solution

You have a few options, but the quickest is probably to just use a dummy value:
SQL
    SELECT chln_prefix,chln_no,chln_name
    FROM PC
EXCEPT
    SELECT prefix,doc_no, 0 AS DummyValue
    FROM PB
 
Share this answer
 
Comments
AspDotNetDev 9-Sep-10 13:30pm    
Oh, and the data type should probably match. looks like you are expecing a name, so instead of 0 you might want to use 'blah'.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900