select distinct + id

From: Date: Sun, 23 Sep 2001 01:02:39 +0000
Subject: select distinct + id
Groups: php.db 
Request: Send a blank email to php-db+get-12658@lists.php.net to get a copy of this message
i have a table like this +-----------+---------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+---------------------+------+-----+---------+----------------+ | id | int(100) unsigned | | PRI | NULL | auto_increment | | dir_name | varchar(255) | YES | | NULL | | | file_name | varchar(255) | YES | | NULL | | --------------------------------------------------------------------------- and i want to do the following select : select distinct dir_name, file_name from tablename where dir_name like "%th_same_foo%" or file_name like "%the_same_foo%" ; but i also wont to have the id's of fields i've selected, and it makes no sense to put select distinct id, dir_name, ....... cause a primary key is always distinct does anyone know how to do all this in one select statement? thanks in advanse

« previous php.db (#12658) next »