Solved

Delphi 3->SQL->SQLBase 7

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

914 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

21 Experts available now in Live!

Get 1:1 Help Now