IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

remove dups and Order the rows


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Jul 27, 2011 7:49 pm
Reply with quote

I didn't depend on it, but because in this case the order of the union all was correct, I didn't notice my mistake:

Code:
with cte(COL_A,COL_B) as (
select 'P4', 'BLUE PART' from sysibm.sysdummy1 union all
select 'P2', 'CLOSED PART 2' from sysibm.sysdummy1 union all
select 'P3', 'PART 3' from sysibm.sysdummy1 union all
select 'P2', 'CLOSED PART 2' from sysibm.sysdummy1 union all
select 'P1', 'ALL PARTS' from sysibm.sysdummy1 union all
select 'P5', 'PART 5' from sysibm.sysdummy1 union all
select 'P6', 'CLOSED PART 6' from sysibm.sysdummy1 )

select col_A,col_b from cte
group by col_a,col_b
order by posstr(col_b,'CLOSED'),col_a
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Rotate partition-logical & physic... DB2 0
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Remove leading zeroes SYNCSORT 4
Search our Forums:

Back to Top