[EMAIL PROTECTED] wrote: >> Mark Wilson <[EMAIL PROTECTED]> wrote: >>> Two related questions. >>> 1. I have a table with a "date" field. (Ex: '04/13/2002'). I want to get >>> a list >>> of all UNIQUE values for that field (many entries from the same day), >>> i.e., all >>> days with entries. >>> ************************************** >>> CREATE TABLE metrics_events_power { >>> mep_id int(11) NOT NULL auto_increment, >>> mep_date text, >>> mep_time time DEFAULT '00:00:00' NOT NULL >>> } >>> INSERT INTO metrics_events_power VALUES ('1', '04/13/2002', '10:41:19'); >>> INSERT INTO metrics_events_power VALUES ('1', '04/13/2002', '10:46:19'); >>> INSERT INTO metrics_events_power VALUES ('1', '04/14/2002', '11:51:19'); >>> ************************************** >>> >>> I want a query that returns for this data '04/13/2002' and '04/14/2002'. >> >> Use WHERE clause to set retrieval conditions for rows, f.e WHERE >> mep_date='04/13/2002' OR mep_date='04/14/2002', and GROUP BY mep_date. > > Not exactly. I want the retrieval to be automatic. I don't want to know in > advance what the unique dates are; I want the query to tell me which > unique dates exist. So for this data, two dates would be returned. For > other data, more or fewer dates.
SELECT DISTINCT mep_date FROM metrics_events_power; -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]