Re: copying field data to another field
Posted in 1996
Gail Reynolds wrote:
>
> Hi,
>
> I need help in copying field information FROM (in1acst) in table in1fr
> TO field (in2acst) in table in2fr. These are my inventory tables and
> my average cost fields. I think I need to do something like this:
>
> Select in1acst
> From in1fr
> Where in1itm between "7516002" and "7516475">
> Into Temp in1temp;
>
> Select in2acst
> From in2fr
> Where in1itm between "7516002" and "7516475"> Insert Into ???
>
> This is as far as I got. Any help will be appreciated.
>
> Gail
Hi Gail !
If the records are not currently existing in in2fr, then try
INSERT INTO in2fr (other_fields,in2acst)
SELECT other_fields,in1acst
FROM in1fr
WHERE in1itm BETWEEN "7516002" AND "7516475";
If the records for the given range of in1itm do already exist you have to use
an UPDATE statement to achieve the requested result:
UPDATE in2fr t2
SET in2acst = (SELECT in1acst
FROM in1fr t1
WHERE t1.in1itm = t2.in1itm
)
WHERE t1.in1itm BETWEEN "7516002" AND "7516475"
;
Hope this helps !
Tschuess,
Dirk
--
---------------------------------------------------
Dirk Schmidtpott S I E M E N S
EMail: schmidtpott.pad@sni.de =============
Phone: 0049-5251-8-14922 N I X D O R F
Fax : 0049-5251-8-27905
The above statements and opinions are my own and do
not necessarily represent those of my employer.
---------------------------------------------------