hi,

i have 2 tables:

  currency                                    rates
+---------------------+            +----------------------------+
| code char(3)        |            | currency char(3)           |
| name varchar(10)    |            | rate double                |
| bcurrency char(1)   |            | ryear varchar(4)           |
|                     |            | rmonth varchar(10)         |
+---------------------+            +----------------------------+

I'm have a form, from which i pick 2 value "2000" and "february".
I'm trying to insert fields form currency to rates, matching particular
conditions in order to avoid data duplication.
The rate table basically has the exchange rate for a particular currency
in a particular year and a particular month.
The trio currency,ryear,rmonth SHOULD be unique.

My query is the following:
insert into rates (currency,ryear,rmonth)
select a.code, "2000", "february"  from currency a, rates b
where a.bcurrency="N"
and a.code<>b.currency and b.ryear="2000" and b.rmonth="february"





_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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