|
The records will have a temp flag, it should be the same value
though. If its a non temp controlled load it'll be 0, otherwise it'll
have a temp - what I don't want is a record with multiple stops (the
first count) that have different temps... that's a major issue.
On 11-Aug-2014 11:45 -0500, Steve Stevens wrote:
If it doesn't you might be able to use a CTE:
With FlgCnt as (
Select CmlPro#, tempflag, count(tempflag) as cnt
from PBF1809
Where cmlShipDt > 20140101 and CmlShipDt < 20140901
group by CmlPro#, tempflag
)
select CmlPro#, tempflag, cnt
from FlgCnt
where cnt > 1;
On 11-Aug-2014 11:33 -0500, Robert Rogerson wrote:
Would this work?
Exec SQL Declare C1 Cursor
For Select CmlPro#, tempflag, count(tempflag) as cnt
from PBF1809
Where cmlShipDt > 20140101 and CmlShipDt < 20140901
group by CmlPro#, tempflag
having count(tempflag) > 1;
This would return the Pro(s) having multiple tempflags.
On 8/11/2014 11:09 AM, RPGLIST wrote:
I need to run a query (SQL) to find some records that are bad.
I need to find all freight movements with multiple stops that
have a temp flag that is different on the same pro number. I
can get the first part:
Exec SQL Declare C1 Cursor
For Select CmlPro#, count(*) as cnt
from PBF1809
Where cmlShipDt > 20140101 and CmlShipDt < 20140901
group by CmlPro# having count(*)> 1;
What I need to figure out is how to add in the same statement
if possible, where CmlTempFlg is different for any of those pro
numbers?
Example:
Pro TempFlg
__________________
548798 32
548798 32
548798 58
548798 -5
...
All the records should have the same temp flg.
Suggestions?
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.