Solved

Need a SQL query

Posted on 2013-01-03
6
358 Views
Last Modified: 2013-01-03
Experts,

I need a SQL query and the details are attached.

Thanks for your help.
doc2.docx
0
Comment
Question by:Tpaul_10
6 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 38741554
looks like homework to me. how do you think you will learn something if you don't even try to do your own homework?
0
 
LVL 1

Assisted Solution

by:WaibelRD
WaibelRD earned 50 total points
ID: 38741565
SELECT distinct QNumber
FROM QDETAILS
where DiscountGiven is NULL
and QNumber in (
select QNumber from Qnumbers where DiscountType in ('A','B'))
AND QNumber not in (
select QNumber from QDETAILS Where DiscountGiven = 'Y' )
Order by QNumber
0
 
LVL 32

Expert Comment

by:awking00
ID: 38741583
Select QNumber from QNumbers where DiscountType in (A','B')
intersect
Select QNumber from QDetails where DiscountGiven is null;
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 32

Expert Comment

by:awking00
ID: 38741594
Not quite, need to deal with P7 case.
0
 
LVL 32

Accepted Solution

by:
awking00 earned 450 total points
ID: 38741831
Select QNumber from QNumbers where DiscountType in ('A','B')
intersect
Select QNumber from QDetails where DiscountGiven is null
except
Select QNumber from QDetails where DiscountGiven = 'Y'
0
 

Author Closing Comment

by:Tpaul_10
ID: 38742521
Thanks awking00 and  WaibelRD. Appreicate your help guys and sorry, I should have posted the SQL i have tried.


emoreau : DON'T ASSUME ANYTHING AND IF YOU DON'T WANT TO RESPOND, JUST SHUT UP OR DON'T RESPOND.
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now