continuo a non capire
Provo a fare un esempio (tratto dalla documentazione mySQL su www.mysql.org)
se io eseguo questa query:codice:+----------+--------+---------+------+------------+------------+ | name | owner | species | sex | birth | death | +----------+--------+---------+------+------------+------------+ | Fluffy | Harold | cat | f | 1993-02-04 | NULL | | Claws | Gwen | cat | m | 1994-03-17 | NULL | | Buffy | Harold | dog | f | 1989-05-13 | NULL | | Fang | Benny | dog | m | 1990-08-27 | NULL | | Bowser | Diane | dog | m | 1979-08-31 | 1995-07-29 | | Chirpy | Gwen | bird | f | 1998-09-11 | NULL | | Whistler | Gwen | bird | NULL | 1997-12-09 | NULL | | Slim | Benny | snake | m | 1996-04-29 | NULL | | Puffball | Diane | hamster | f | 1999-03-30 | NULL | +----------+--------+---------+------+------------+------------+
ottengo come risultato le colonne owner e species "depurate da doppioni" ovvero così?codice:SELECT DISTINCT owner, species from pet
oppure il distinct agisce solo sul primo campo ovvero su owner?codice:| owner | species +--------+-------- | Harold | cat | Gwen | cat | Harold | dog | Benny | dog | Diane | dog | Gwen | bird | Benny | snake | Diane | hamster


					
					
					
						
  Rispondi quotando