Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL Select Distinct question

$
0
0

Can't get my head around this one and I'm wondering if all the smart SQL guys out there can help me?

I need to select opportunities from a table only if there is no quote with a 'TRUE' condition. Each opportunity can have many quotes.

Below is the query I'm using [dbo.Quotes.quot_master is the true/false test] but this query returns some incorrect entries.

So, to summarise, I need the query to return all of the Opportunities only where all of the attached quotes are quot_master = NULL.

Can you help please?

Text
SELECT TOP (100) PERCENT dbo.Opportunity.oppo_ref AS 'Opportunity Reference', dbo.Company.Comp_Name AS 'Company Name', dbo.Company.Comp_Status AS 'Company Status', dbo.Company.Comp_Type AS 'Company Type', dbo.Opportunity.Oppo_Description AS 'Opportunity Description', dbo.Opportunity.Oppo_Stage AS 'Opportunity Stage',...

Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>