Advertisement

06.08.2008 at 12:14PM PDT, ID: 23467503 | Points: 500
[x]
Attachment Details

selecting record 'b' if 'a' does not exist

Asked by impersonator in SQL Query Syntax, MS SQL Server

Tags: ,

I'm running a query similar to:

select addrid, addrline1, addrcity, addrstate, addrzip from address
where addrflag1 = 'Y' //mandatory
and addrflag2 = 'N' //mandatory
and addrflag3 = 'N' //mandatory
and addrflag4 = 'g' //mandatory
and addrtype in ('h','b') //either home or business address

Since it's possible for both, home and business address to meet the mandatory criteria, I may get results with both address.  I want to get the business address if and only if the home address is not selected.

How do I go about doing that?Start Free Trial
[+][-]06.08.2008 at 12:49PM PDT, ID: 21739346

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.08.2008 at 05:49PM PDT, ID: 21740177

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 04:38AM PDT, ID: 21742366

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 02:07PM PDT, ID: 21929072

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 02:19PM PDT, ID: 21929166

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 04:57PM PDT, ID: 21930210

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.04.2008 at 04:32AM PDT, ID: 21932406

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628