-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thu, 14 Jun 2001, Dinkler, Fred wrote:
> Unclear as to your intent, e.g. what does 'replace" mean?
> This SQL will display the id and hotel name for those hotels in the travel
> table.
Ok, the hotel table holds the hotel names and the travel.nome_hotel also
hold the table name (why? becuase the client need it that time). Now I
create the hotel table and dumped all the hotel names from the travel
table to the hotel table. Now that is done I need to remove the the hotel
names from the travel.nome_hotel and give them the corresponding id from
the hotel table. I was thinking something like this
update travel set nome_hotel=hotel.id where
hotel.hotelname=travel.nome_hotel.
It does not work. What would be the corret way?
>
> SELECT t.id, h.hotelname from travel t, hotel h where t.nome_hotel =
> h.hotelname;
This will just display the rows. I need to update the travel table with
the id of hotel table based on the hotel names being the same.
TIA
Adrian
>
> -----Original Message-----
> From: Adrian D'Costa [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 14, 2001 1:49 AM
> To: Mysql Mailing List
> Subject: how do I do this
>
>
> Hi,
>
> I have two table:
>
> mysql> select * from hotel limit 10
> -> ;
> +----+--------------------+
> | id | hotelname |
> +----+--------------------+
> | 1 | Adams Beach |
> | 2 | Aegean Village |
> | 3 | Angela |
> | 4 | App. in Ayja |
> | 5 | Apt Alfaga |
> | 6 | Apt. Central Playa |
> | 7 | Arabia Beach |
> | 8 | Asterias Beach |
> | 9 | Baron |
> | 10 | Bel Air |
> +----+--------------------+
>
> and travel
>
> +-----------------+
> | nome_hotel |
> +-----------------+
> | Vol seul |
> | Carina |
> | Relax |
> | Mistral |
> | Esperides Beach |
> | Vol seul |
> | Angela |
> | Marmari Beach |
> | Summer Palace |
> | Aegean Village |
> +-----------------+
>
> What I want to do is replace the nome_hotel field with the ids of the
> hotel table for names that match the hotel.hotelname in the
> travel.nome_hotel. How do I do this.
>
> 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
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.2 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE7Kcqz/f1mUNueu/oRAj9lAKCm6/oRkK12ApKACkYw/m7tyUijCwCgj1R5
6vTrU6rOotFVaOsCeF1zMWw=
=VYdY
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
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