dbTalk Databases Forums  

Last X Rows from a Table

comp.databases.btrieve comp.databases.btrieve


Discuss Last X Rows from a Table in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Markus Jäger
 
Posts: n/a

Default Last X Rows from a Table - 08-27-2003 , 04:13 AM






Ich suche nach einer Lösung um die letzten X- Sätze aus einer Tabelle zu
bekommen.
Also die Tabelle EINGANG enthält die z.B die Felder Lieferant, Artikel,
Datum.

Jetzt will ich die letzten Eingänge des Lieferanten x, also:
Select from EINGANG where Lieferant = X
order by datum desc
So und nun will ich aber nur die letzten 5 Eingänge. Wie geht das?
Bei Microsoft SQL geht das ja mit 'Select Top 5...'

Danke für eine Antwort Markus


I'm looking for a possibility to get the last X Rows from a table
For example: table is EINGANG, Fields are Lieferant, Artikel, Datum.

With the following statement I could get the rows orderd by DATUM:
Select from EINGANG where Lieferant = X order by datum desc

But now I'm only interested on the first 5 rows.
In Microsoft SQL you can do this with 'Select Top 5...'
but in pervasive?
Thanks for an answer Markus



Reply With Quote
  #2  
Old   
Bill Bach
 
Posts: n/a

Default Re: Last X Rows from a Table - 08-27-2003 , 09:36 AM






You can use the "TOP" keyword with Pervasive.SQL V8, as in your example.
This function was not in previous versions.
Goldstar Software Inc.
Building on Btrieve(R) for the Future(SM)
Bill Bach
BillBach (AT) goldstarsoftware (DOT) com
http://www.goldstarsoftware.com
*** Pervasive.SQL Service & Support Classes ***
Chicago: September 16-18: See our web site for details!

"Markus Jäger" wrote:

Quote:
Ich suche nach einer Lösung um die letzten X- Sätze aus einer Tabelle zu
bekommen.
Also die Tabelle EINGANG enthält die z.B die Felder Lieferant, Artikel,
Datum.

Jetzt will ich die letzten Eingänge des Lieferanten x, also:
Select from EINGANG where Lieferant = X
order by datum desc
So und nun will ich aber nur die letzten 5 Eingänge. Wie geht das?
Bei Microsoft SQL geht das ja mit 'Select Top 5...'

Danke für eine Antwort Markus

I'm looking for a possibility to get the last X Rows from a table
For example: table is EINGANG, Fields are Lieferant, Artikel, Datum.

With the following statement I could get the rows orderd by DATUM:
Select from EINGANG where Lieferant = X order by datum desc

But now I'm only interested on the first 5 rows.
In Microsoft SQL you can do this with 'Select Top 5...'
but in pervasive?
Thanks for an answer Markus


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.