Solved

Delphi 3->SQL->SQLBase 7

Posted on 1998-09-16
2
209 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi: how to implement a User Shortcut mapper? 1 117
HTML text in the body of an email (delphi code) 12 166
Downloading email attachments 2 79
CheckListBox usage 3 71
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

839 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