|
// Assuming 2 plants select distinct asn from mytable group by asn having count(asn) = 2
AlanShore@xxxxxxxx 02/15/2007 10:59:29 AM >>>
Try Select distinct A.ASN from table as A, table as B where A.ASN = B.ASN and A.PLANT <> B.PLANT I think Alan Shore NBTY, Inc (631) 244-2000 ext. 5019 AShore@xxxxxxxx rpg400-l-bounces@xxxxxxxxxxxx wrote on 02/15/2007 01:55:02 PM:
Hi All, Can someone suggest the best way to get at this data via an SQL statement? I have a table that has two specific fields in which I am interested. One field is a plant code and the other field is an ASN field. I want to run an SQL statement that will show me all the ASNs that are used
by
both plants. So if the table has: 1, 10200 1, 10201 2, 30210 2, 23041 1, 30210 I would like to run a statement that will show me: 30210 This should be the only ASN to appear since it is used by both Plant
One
and Plant Two. Any ideas? I'm pretty sure it's blatantly obvious, but I'm having a
bit
of an issue trying to get the statement correct. Thanks! /b; -=-=-=-=-=-=-=-=-=-=-=-=-=- Brian Piotrowski Assisstant Mgr. - I.T. Simcoe Parts Service, Inc. Ph: 705-435-7814 x343 Fx: 705-435-6746 -=-=-=-=-=-=-=-=-=-=-=-=-=-
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.