Solved

Need a SQL query

Posted on 2013-01-03
6
372 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 70

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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

627 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