Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 27th, 2003, 09:25 AM
Authorized User
 
Join Date: Jun 2003
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Default

this is my solution:

Code:
select S1.JobCode
from SODts S1
    left join SODts S2 on S2.JobCode = @JobCode
        and S2.Quality = S1.Quality
        and S1.JobCode <> @JobCode
group by S1.JobCode
having sum(case when S2.JobCode is null then 1 else 0 end) = 0
    and count(S1.JobCode)
        = (select count(*) from SODts S where S.JobCode = @JobCode)


defiant.





Similar Threads
Thread Thread Starter Forum Replies Last Post
complex query... help plz hello MySQL 1 April 28th, 2007 05:48 AM
complex query g_vamsi_krish SQL Language 3 February 27th, 2006 10:48 AM
query too complex [email protected] Access 3 August 28th, 2003 09:01 AM
COMPLEX QUERY PROBLEM nikosdra SQL Server ASP 15 August 4th, 2003 06:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.