Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » OrderBy in descending order [ANSWER FOUND]
OrderBy in descending order [ANSWER FOUND] [message #5054] Fri, 01 September 2006 15:39 Go to next message
zsolt is currently offline  zsolt
Messages: 697
Registered: December 2005
Location: Budapest, Hungary
Contributor
Hi, is it possible to create a SELECT with "ORDER BY FIELDNAME DESC" using an explession like this?
sql * Select(FIELDNAME).From(TABLENAME).OrderBy(FIELDNAME);

[Updated on: Fri, 01 September 2006 15:47]

Report message to a moderator

Re: OrderBy in descending order [message #5055 is a reply to message #5054] Fri, 01 September 2006 15:45 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 697
Registered: December 2005
Location: Budapest, Hungary
Contributor
Sorry for the above question, I found Descending() function Smile
Re: OrderBy in descending order [message #5059 is a reply to message #5055] Fri, 01 September 2006 18:28 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Yep, there is no "postfix function syntax" in C++ Smile

Mirek
Re: OrderBy in descending order [message #13146 is a reply to message #5059] Sun, 16 December 2007 17:32 Go to previous messageGo to next message
lokki is currently offline  lokki
Messages: 20
Registered: November 2005
Promising Member
A bit curious about this. Why not to implement a function like OrderByDesc(const SqlSet& set) ?

It is a little hack to Core and I've found it already useful (when doing background data modifications in DB without GridCtrl or any other "viewer" involved)

Thanks for answer.
Re: OrderBy in descending order [message #13335 is a reply to message #13146] Wed, 02 January 2008 09:03 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
lokki wrote on Sun, 16 December 2007 11:32

A bit curious about this. Why not to implement a function like OrderByDesc(const SqlSet& set) ?

It is a little hack to Core and I've found it already useful (when doing background data modifications in DB without GridCtrl or any other "viewer" involved)

Thanks for answer.



What should it do?

Mirek
Re: OrderBy in descending order [message #13337 is a reply to message #13335] Wed, 02 January 2008 11:22 Go to previous messageGo to next message
lokki is currently offline  lokki
Messages: 20
Registered: November 2005
Promising Member
It should fetch results in descending order

SELECT COL1, COL2 FROM SOME_TABLE ORDER BY COL2 DESC
Re: OrderBy in descending order [message #13338 is a reply to message #13337] Wed, 02 January 2008 11:51 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

From HomeBudget:

        SQL & ::Select(NAME, SqlId("sum(value) as val"))
            .From(MONEY, CATEGORIES)
            .Where(DT_ID == dtid && CAT_ID == ID.Of(CATEGORIES) && PM.Of(MONEY) < 0)
            .GroupBy(CAT_ID)
            .OrderBy(Descending(SqlId("val")));


Just add Descending to OrderBy
Re: OrderBy in descending order [message #13339 is a reply to message #13338] Wed, 02 January 2008 11:53 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Oops I overlooked answers above Smile
Re: OrderBy in descending order [message #13340 is a reply to message #13339] Wed, 02 January 2008 11:56 Go to previous message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

I think we could provide OrderByAsc and OrderByDesc (Dsc). It's more natural (from C++ point) than Descending (which it's more correct looking at SQL syntax)
Previous Topic: How to use Clipboard in HomeBudget(SqLite3)?
Next Topic: XML Parser has no support for DTD
Goto Forum:
  


Current Time: Fri Apr 26 10:51:11 CEST 2024

Total time taken to generate the page: 0.05847 seconds