views:

124

answers:

3

Hello,

i'm creating a web app that's running on an Advantage Database server, not my personal weapon of choice but that's what the company uses. I have a couple of big lists that the end-users need to be able to view however i can't seem to find a way to page through the results in SQL.

Is there something like LIMIT / OFFSET for Advantage Database? If no, any suggestions on approaching this?

thank you in advance!

+1  A: 

According to this, the correct syntax for LIMIT in Advantage is SELECT TOP 10 * FROM YOURTABLE.

klausbyskov
thank you, however that doesn't solve my paging problem
dries.hoebeke
@dries.hoebeke : Yes, apparently there is no `ROWNUM` function so having the ability to use `SELECT TOP` gets you nowhere in terms of paging. I guess your only remaining choice is to load everything into memory and do your paging logic. It's definitely a solution of maximum suckage, but I don't really see that you have other options. If you haven't already, you should probably vote for the future implementation of `ROWNUM` here: http://feedback.advantagedatabase.com/forums/2671-general/suggestions/30213-return-query-specific-row-number-
klausbyskov
A: 

From my previous experience, Advantage Database is horrible and crap! We used it in a hospital environment for Patients Administration System (outsourced to 3rd party vendor), it was slow and unwieldy when multiple users access the system across the network and found that everything actually slows down. IT became a talking point as it caused unnecessary stress especially with the amount of people traffic in A&E in particular. Talk to the bosses about migrating over to {SQL Server|MySQL} or better and use a proper database, the SQL dialect on Advantage is not standard...and there is weird caching issues which causes latency...we ended up ditching Advantage for a better system and everyone was happy...

Hope this helps, Best regards, Tom.

tommieb75
I know I will get flamed for this, but I am expressing an opinion on this based on previous experience.
tommieb75
it's good advice, i know. Migrating, unfortunately, is not an option.thanks for your time :)
dries.hoebeke
There are tens of thousands of Advantage applications that work great. I would consider trashing the vendor who wrote the application before the database. That's like saying, "The Qt framework is horrible and crap!" because some application vendor wrote a poor application using it.
Jeremy Mullin
@Jeremy: I am sorry if my answer was sounding negative, but used in a hospital where life and death is concerned, Advantage was just not cut out for that scenario - I administered the system, needless to say, the hospital management were relieved, as I pointed out it was ditched for in favour of SQL Server...less stress, more Patient Audit System functionality....
tommieb75
Advantage is used in that scenario every day. Too bad your experience wasn't good, but no need to generalize, especially when it doesn't help answer this question.
Jeremy Mullin
+5  A: 

I understand that LIMIT and a ROWNUM will be new features in an upcoming version of Advantage. http://feedback.advantagedatabase.com/forums/2671-general/suggestions/30213-return-query-specific-row-number-?ref=title

However, until then, I have used this in the past to select row 50-60.

select top 10 * from mytable where rowid not in (select top 50 rowid from mytable)

@tommieb75, you indicated that the SQL dialect was not standard. I have found that it is based on the standards containing most of the SQL-92 standard and some of the SQL-2003 features.

Edgar
this seems to work, allthough i must say it takes less time to fetch the entire table (which has around 160K records) then it takes to get a certain page out of it. also, how does this work on joined tables?
dries.hoebeke