|
|
ORDER BY statements
1) That obviously works. Now this: 2) Also works. However, this currently fails: 3) While these work: 4) Turns out the This has a ramification for WOWebLog project. I have a derived attribute in my EOModel that calculates the "popularity" of all the articles in the database. I then have the database sort on that derived attribute/column to deliver the top 10 most popular articles. The problem is that EOF is somewhat dumb about derived attributes -- it simply copies over the entered text wherever it's referenced. That means I wind up with SQL like this: SELECT PK, CREATION_DATE, HIT_COUNT, (HIT_COUNT/CURRENT_TIMESTAMP - CREATION_DATE) FROM ENTRY ORDER BY (HIT_COUNT/CURRENT_TIMESTAMP - CREATION_DATE) Note: I simplified the derived column here for sake of discussion, the real SQL is This results in an error, as does this: SELECT PK, CREATION_DATE, HIT_COUNT, (HIT_COUNT/CURRENT_TIMESTAMP - CREATION_DATE) AS MY_COLUMN FROM ENTRY ORDER BY (HIT_COUNT/CURRENT_TIMESTAMP - CREATION_DATE) AS MY_COLUMN Right now MySQL and OpenBase allow such statements in ORDER BY clauses (that is, statement #3 above works). This website is deployed on OpenBase, and you can work-around FrontBase's limitation using hand-coded SQL fetchspecs, so it wasn't a greatly pressing issue yet. Still, I filed a feature request with FrontBase in January. Today Geert wrote back saying the feature will be in the next general release of FrontBase 3.x (probably Update: Geert says the next release will be 3.6.12 I must say FrontBase and OpenBase have the most responsive folks in the database biz. They're both very customer-driven, which is rather refreshing in today's world. Sunday, February 23, 2003
|
Contact Me Topics RSS Feed Linkblog
Bill Bumgarner Brent Simmons Daniel Jalkut Dave Dribin Eric Albert Eric Rescorla Eric Sink Greg Miller Gus Mueller Jeremy Zawodny John Gruber Mark Dalrymple Michael Tsai Peter Ammon Raymond Chen Ryan Wilcox Scott Stevenson Steven Frank The Daily WTF we hates software Wil Shipley |
Copyright © 1997-2008 Jonathan 'Wolf' Rentzsch. All rights reserved.
Questions? Comments? Contact Me.