Jump to content


Photo

Query Efficiency


  • Please log in to reply
1 reply to this topic

#1 chreez

chreez
  • Members
  • Pip
  • Newbie
  • 4 posts
  • Locationm4rf

Posted 28 October 2003 - 07:48 PM

Sample Table
| id    |  date            | time      | ref  |  0    |    10/10/10   | 9:51      |    2|  1    |    10/10/10   | 9:52      |    2|  2    |    10/10/10   | 9:53      |    4|  3    |    10/10/11   | 9:54      |    3|  4    |    10/10/11   | 9:55      |    4|  5    |    10/10/11   | 9:56      |    2

I need to get each row where ref != id and then get the row where date, time is greatest.

Example output
| id    |  date            | time       | ref  |  2    |    10/10/10   |  9:53      |    4|  5    |    10/10/11   |  9:56      |    2

The results have ref != id and other rows where ref != id are eliminated because they have lesser values in date, time.

What is the best way to do this

#2 DylanBlitz

DylanBlitz
  • Members
  • PipPipPip
  • Advanced Member
  • 99 posts
  • LocationOC Baby!

Posted 28 October 2003 - 08:55 PM

shouldn\'t double post :P hehe

http://www.phpfreaks...s/topic9870.php




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users