Re: fetch row DISTINCT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 9 Jul 2004, Peter Westergaard wrote:
>
> One idea that occurs to me, and it's a tradeoff from Torsten's idea (which
> is to read the whole database, and parse out the unique rows), is to first
> execute your "SELECT DISTINCT distinct_col FROM table", and then walk
> through that, and for each one issue a "SELECT * FROM table WHERE
> distinct_col = {value} LIMIT 1"  (For some reason I can't remember the
> 'LIMIT' syntax right now, so it might be LIMIT 0,1).  More transactions with
> the database, but less data actually retrieved from the database.  And if
> it's indexed by distinct_col, you should be fine.

It´s not to start a war, but after having to hear so much about how good
MySQL is.

What you need is a database with sub-select capability, or to have a
feature like:

SELECT DISTINT ON(col1), col2, col5 FROM table1 WHERE...

People say that they don´t need sub-selects (transactions, procedural
languages, etc.) just because the don´t have an idea of the power that the
hold.

Just a par of cents on my part.

--
 19:55:02 up 8 days, 11:32,  2 users,  load average: 0.12, 0.15, 0.10
-----------------------------------------------------------------
Martín Marqués        | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica  |  DBA, Programador, Administrador
             Universidad Nacional
                  del Litoral
-----------------------------------------------------------------

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux