Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query problem!

Status
Not open for further replies.

Inandjo

Programmer
Dec 7, 2001
46
FR
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=&quot;2000&quot; and b.rmonth=&quot;february&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top