× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks so much, Birgitta!

With your help, I was able to get the statement to work the way I need it.  
Here's my final statement:

Select distinct asno From sst02 Group By asno
Having count(Distinct asplcd) > 1            

Thanks again!

Brian.

-----Original Message-----
From: BirgittaHauser [mailto:Hauser@xxxxxxxxxxxxxxx] 
Sent: Saturday, February 24, 2007 12:01 PM
To: RPG Midrange L
Subject: @Brian Piotrowski: SQL Stratement Help

@Brian Piotrowski,
 
You sent  me a private mail concerning a SQL statement. I tried to answer
your eMail, but my eMail address was denied from your system.
That's why I use this way to send you my answer.
 
An: 'Brian Piotrowski'
Betreff: SQL Stratement Help

Hi Brian,
 
I'm not sure what you want to archieve, but to determine all Rows where
SCAC, Trailer, Delivery Date and Delivery Date are identical, but plant
different, you may use the following query:
 
Select SCACCode, Trailer, DeliveryDate, DeliveryTime, count(Distinct Plant)
as Plant
   From MyTable
   Group By SCACCode, Trailer, DeliveryDate, DeliveryTime
   Having Count(Distinct Plant) > 1
 
If you want to see the complete rows, you simply have to use the query above
as either subquery in the from clause or as common table expression and join
it in the final SELECT as follows:
 
with x as (Select SCACCode, Trailer, DeliveryDate, DelTime, count(Distinct
Plant) as Plant
             From MyTable
             Group By SCACCode, Trailer, DeliveryDate, DeliveryTime
             Having Count(Distinct Plant) > 1)             
Select a.* from x join MyTable a using (SCACCode, Trailer, DeliveryDate,
DeliveryTime)
Order By a.SCACCode, a.Trailer, a.DeliveryDate, a.DeliveryTime;
 

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)

"If you think education is expensive, try ignorance." (Derek Bok)

"What is worse than training your staff and losing them?  Not training them
and keeping them!"

 


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.