dan wrote:
> The MAX(id) didn't return anything,
Best check your data types, and syntax. Either ID is somehow a string value, or
you are offering the wrong SQL syntax:
mysql> describe test2;
+-+-+--+-+-++
| Field | Type| Null | Key |
Yet another solution
SET ROWCOUNT 1
SELECT id FROM table ORDER BY id DESC
Only works if there is an index on id and the RDBMS support backward scans
Chuck
[EMAIL PROTECTED] wrote:
Another solution :
For your query, try "SELECT MAX(id) FROM table"
That works with mysql.
-Message d'origine
0
SQL> insert into table_id(id) values (1);
1 row created.
SQL> select nvl(max(id), 0) from table_id;
NVL(MAX(ID),0)
--
1
==
Michel
-Message d'origine-
De: dan [mailto:[EMAIL PROTECTED]
Date: dimanche 26 octobre 2003 14:40
À: [EMA
Thanks I'll try your suggestion about the LIMIT portion, that's what I want,
to minimize the amount of data the program gets from the SQL server, making
processing faster.
The program isn't a script as such that's executed from the web, it's a
program that opens a socket, connects to IRC chat and
The MAX(id) didn't return anything, i eventually settled for an idea posted
to
SELECT id FROM memodata ORDER BY id DESC
then take the first line value and ignore the rest. Ideally though i want
the last line with the highest id number. I know for a fact that another
INSERT won't happen before the S
On Sun, 26 Oct 2003 13:40:20 +, dan wrote:
> The MAX(id) didn't return anything [...]
Are you sure about that? Generally, MAX(id) _always_ returns something,
ie:
SELECT MAX(user_id) FROM user
This one will return the highest 'user_id' value, _or_ 0 if there are no
records in the 'user' ta
On Sun, 26 Oct 2003 06:30:11 +0100, SIMON Cedric wrote:
> For your query, try "SELECT MAX(id) FROM table"
> That works with mysql.
That should "work" with most databases, but what happens if there's a new
insert between the original insert and the SELECT statement above?
This _could_ be solved b
Another solution :
For your query, try "SELECT MAX(id) FROM table"
That works with mysql.
-Message d'origine-
De : dan [mailto:[EMAIL PROTECTED]
Envoyé : samedi 25 octobre 2003 11:44
À : [EMAIL PROTECTED]
Objet : SQL Syntax quickie
Hi,
I've looked around to not much avail, what I'm l
On Sat, 25 Oct 2003 10:43:51 +0100, dan wrote:
> Basically what happens is the program enters information using INSERT, and
> then it needs to re-read the data it's just sent to verify it, and get the
> id number that auto_increment assigned it.
You don't say anything about what RDBMS you're using
dan wrote:
Hi,
I've looked around to not much avail, what I'm looking for is a SELECT query
that selects the last record in a database. Each table has the primary field
"id", to which auto increments on each input. I don't want to have to load
the entire db, cycle through it until I find the last
10 matches
Mail list logo