> -----Original Message-----
> From: Yevgeny Dyatlov [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 23, 2001 8:05 AM
> To: PHP-DB
> Subject: [PHP-DB] How I can use multiple results in MySQL
> I'm cann't using query to MySQL like this:
> SELECT name FROM cia WHERE region =
> (SELECT region FROM table WHERE name = 'Brazil');
> And
> SELECT name FROM table WHERE count =
> (SELECT max(count) FROM table);
> I want to select COLUMN_NAME in TABLE where ID is max,
> how I can do it?

MySQL doesn't support sub-selects.  

However, in many cases you can get the same result by either
reorganizing your queries or creating a temporary table.  For more info,


For example, your first query, rearranged to use joins, might wind up
looking something like

        SELECT cia.name
        FROM cia, table
        WHERE cia.region = table.region 
        AND table.name='Brazil'

For the second, I'd do something like

        SELECT name
        FROM table
        ORDER BY count DESC
        LIMIT 1

Mark Roedel ([EMAIL PROTECTED])  ||  "There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full."
     LeTourneau University      ||                    -- Henry Kissinger

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to