Hi Jim and others that tried to help me!
Thanks for any kind os answer.
Well, the SQL command that you suggested don't work for me. Below, I will
show What I want and what I get if I use the select command you suggested:
1) What I have:
Table: processo_arquivos
_________________________
|Cod | Date |
-------------------------
|1 | 12/10 |
-------------------------
|2 | 13/10 |
-------------------------
|3 | 14/10 |
-------------------------
|4 | 15/10 |
-------------------------
|5 | 16/10 |
-------------------------
2) What I get is I use the SELECT * FROM processo_arquivos ORDER BY DATE
DESC LIMIT 0,3 (considering that I only want 3)
_________________________
|Cod | Date |
-------------------------
|5 | 16/10 |
-------------------------
|4 | 15/10 |
-------------------------
|3 | 14/10 |
-------------------------
3) The problem getting the result like this:
Since I have a link in the header of the tabel that make the ORDER BY work,
when I select de COD after the result above, I should get:
_________________________
|Cod | Date |
-------------------------
|3 | 14/10 |
-------------------------
|4 | 15/10 |
-------------------------
|5 | 16/10 |
-------------------------
but instead of the above I get:
_________________________
|Cod | Date |
-------------------------
|1 | 12/10 |
-------------------------
|2 | 13/10 |
-------------------------
|3 | 14/10 |
-------------------------
So, the problem is when I select a new ORDER BY I make the query in the
entire Table. What I want is to make the query only in the matched results.
I have a php page that starts with a default search (the ten dates). So,
what I really need ia an way to make a select without any "data" from the
DB. I tried to use de LAST_INDEX() function to do this but I didn't go
anywhere. Any ideas???
Best Regards,
Felipe
-----Mensagem original-----
De: Jim Esten [mailto:jesten@stripped]
Enviada em: terça-feira, 3 de dezembro de 2002 17:40
Para: 'Felipe Moreno - MAILING LISTS'; mysql@stripped
Assunto: RE: SQL Select Idea
Something on the order of...
SELECT * FROM processo_arquivos ORDER BY DATE DESC LIMIT 0,10
Seems like that ought to do it..
Jim
Jim Esten
Chief Techbot
WebDynamic http://www.wdynamic.com
-----Original Message-----
From: Felipe Moreno - MAILING LISTS [mailto:ml@stripped]
Sent: Tuesday, December 03, 2002 10:39 AM
To: mysql@stripped
Subject: SQL Select Idea
Importance: High
Hi List Users,
I want to know if anyone has any idea on how can I do the SQL command
below to archive a result.
I have one table called processo_arquivos that have a filed called
DATE and another FIELD called COD (primary key). I want to select the
last TEN
(10) dates from the Database, but only the last TEN. How Can I do this?
Any ideia? I tried the sql bellow o archive this, but I was unable to do
it. I just want to do this with ONLY one select, not with two.
Thanks for any idea.
Regards,
Felipe
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <mysql-thread126423@stripped>
To unsubscribe, e-mail
<mysql-unsubscribe-jesten=wdynamic.com@stripped>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php