I tried <select distinct Location from hotels1 order by Location> and worked. But how can I show all fields of the rows? It doesn't accept any field before <distinct> and shows every row after <distinct> (if I put <select distinct Location, Name ...> )
Thanks again Makis > -----Original Message----- > From: Jay Blanchard [mailto:[EMAIL PROTECTED]] > Sent: Thursday, May 02, 2002 3:23 PM > To: 'savaidis'; [EMAIL PROTECTED] > Subject: RE: get one <name> for each row > > > [snip] > I have one table with about 1000 hotels and name or the city they belong. > I want to run a query to get one row for every city only, to put it in a > pull down menu in the search form. > How is that? > [/snip] > > SELECT DISTINCT city > FROM tblFOO > > So if you have this table; > > +-------------------+------------------------+ > | City | Hotel | > +-------------------+------------------------+ > | Houston | Hotel A | > | Houston | Hotel B | > | Houston | Hotel C | > | San Antonio | Hotel A | > | Dallas | Hotel A | > | Detroit | Hotel A | > | Detroit | Hotel B | > +-------------------+------------------------+ > > The query will return; > > +-------------------+ > | City | > +-------------------+ > | Houston | > | San Antonio | > | Dallas | > | Detroit | > +-------------------+ > > Hope this helps! > > Jay Blanchard > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php