Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
AleCruc94
Contributor III
Contributor III

Order BY

Hi, 

I have this situation here:

 

date, status

01/24/2020 , not validated

01/24/2020, published

I need to order this table for the status column where Publish appears before the Not validated. 

I try in this way  (at the end of the  SQL part)

GROUP BY  Data, status

ORDER BY Data, status ASC

but it doesn't work.. 

do you have any suggestions?

Thanks

 

 
7 Replies
sunny_talwar

How about if you sort status descending?

GROUP BY Data, status
ORDER BY Data, status DESC
AleCruc94
Contributor III
Contributor III
Author

it the same.. but I want it ASC cause I want the letter P before the N

sunny_talwar

....L M N O P Q.... so, if you want P to come before N, wouldn't you need this to be descending? Am I missing something?

AleCruc94
Contributor III
Contributor III
Author

I have this mess here

 

Connector reply error: ErrorSource: Microsoft OLE DB Provider for SQL Server, ErrorMsg: Column 'PCGWEB.dbo.PG0114E_HISMPSCS_PL_Details.pg_status' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY claus

AleCruc94
Contributor III
Contributor III
Author

yes sorry.. however it maybe works if I delete the Group By.. 

 

sunny_talwar

I am not sure I follow... how does this impacting the sort order?

sunny_talwar

I can't really comment about your usage of Group By because I don't really have the full script. Also, I have no idea what exactly are you trying to do. All I can say is that if you want P to come before N, you need to sort descending.