Solved

Delphi 3->SQL->SQLBase 7

Posted on 1998-09-16
2
199 Views
Last Modified: 2010-04-06
I'm using Delphi 3.0 to ask a SQLbase 7 Database.
And I want to know if it exist a direct SQL expression to select the last one created row on a SQLBase7 Table.
Like in ACCESS :
SELECT LAST(column_name) FROM table_name;
0
Comment
Question by:nk51
2 Comments
 
LVL 10

Accepted Solution

by:
Jacco earned 10 total points
ID: 1339847
No in real SQL such a thing doesn't exist. (Access isn't realy SQL) This is because a table can be sorted be all of its separate indices.

Now what you can do is if you know the index you sort on is the following:

SELECT
  Max(ColumnName1)
FROM
  TableName
WHERE
  ColumnName2 = (SELECT MAX(ColumnName2) FROM TableName)

This means for a database you have to define what your last item is. In the example you get the highest value of column1 where column2 is highest.

Several other solution are thinkable.

For example: Use a TTable component and do Table.Last; (this sometimes can be very slow though, watch the SQL monitor)

Regards Jacco

(P.S. Does your database system have stored procedure, I have a solution using these)
0
 

Author Comment

by:nk51
ID: 1339848
My database system doesn't have stored procedure.
Thanks for your help.

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now