Well, could you explain the behave of ORDER BY DATE,COD?

I will show you bellow what I want, graphically:

>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 if 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:
>
PS: When I select the COD (order by COD) it sends the ORDER BY value to the
same select above.

_________________________
>|Cod (link)     | 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???




-----Mensagem original-----
De: Michael T. Babcock [mailto:[EMAIL PROTECTED]]
Enviada em: quinta-feira, 5 de dezembro de 2002 16:02
Para: [EMAIL PROTECTED]
Assunto: Re: SQL Select Idea [ORDER BY]


On Thu, Dec 05, 2002 at 09:41:24AM -0200, Felipe Moreno - MAILING LISTS
wrote:
>    The ten last dates appear as a default result of a Archives page. When
I
> enter for the first time in the page, it give me the last ten Files that
was
> uploaded. In the same page, I can ORDER BY the ten last dates results by
> COD, DATE, NAME or FILE. So, when I click in some os then, I need to ORDER
> the TEN DATES, not the entire table and give ten results, did you get it?

So you want your query to have 'ORDER BY DATE,COD' ??
--
Michael T. Babcock
CTO, FibreSpeed Ltd.     (Hosting, Security, Consultation, Database, etc)
http://www.fibrespeed.net/~mbabcock/

---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to