Hi,

Thanks for assisting me in my earlier query.  I never had the time to try
it out as my office needs keep changing.  In connection to my earlier
question, this is just an extension :)  The hotel names repeat in the
travel table.

My travel table's required fields from the hotel table are:

nome_hotel
tour_operator
cityid
contid
vitofferta
periodo

I need to generate data in the following format:
1.      I need to get the the unique hotel name(nome_hotel), this I use group
by
2.      The related tour_operator's name
3.      The city id and contid
And the hardest (at least to me)
4.      I need to get the last price of the hotel.

This is my sql statement:
mysql> select count(*),travel.nome_hotel,travel.tour_operator,
city.city,travel.vitofferta from travel,city where city.id=travel.cityid
group by travel.nome_hotel limit 5;

The result:
+----------+-------------------+----------------+---------------+------------+
| count(*) | nome_hotel        | tour_operator  | city          |
vitofferta |
+----------+-------------------+----------------+---------------+------------+
|        2 | Abi d'Oru         | HELVETIC TOURS | Sardegna Nord | 1995
|
|        2 | Abou Nawas Djerba | HELVETIC TOURS | Jerba         | 899
|
|        9 | Adams Beach       | HELVETIC TOURS | Cipro         | 1095
|
|        1 | Aegean Village    | HELVETIC TOURS | Cos           | 1099
|
|        2 | Aeneas            | HELVETIC TOURS | Cipro         | 1211
|
+----------+-------------------+----------------+---------------+------------+

Perfect!  But it the price the last inserted price??  I am not sure.  Here
I remove the periodo field as it wraps.

Can you tell me how to do this to create the hotel table?

TIA

Adrian


---------------------------------------------------------------------
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

Reply via email to