Hi
I am rewriting an old Perl script that selectively updates data from one
table to another using this statement:
UPDATE CUSTOMERS
SET
cust1 = ?,
cust2 = NULL,
street = ?,
town = ?,
postcode = ?
WHERE custnum = ?
I am intending to replace it with something like this where 'test' is
the CTE:
UPDATE CUSTOMERS as c
SET
cust1 = (select customer from test where custnum = c.custnum),
cust2 = NULL,
street = (select address from test where custnum = c.custnum),
town = (select town from test where custnum = c.custnum),
postcode = (select postcode from test where custnum = c.custnum)
WHERE custnum = (select custnum from test where custnum = c.custnum)
My question is, do I need this part of the statement:
WHERE custnum = (select custnum from test where custnum = c.custnum)
when I have the other 'where custnum = c.custnum' clauses.
I came across some Web examples that suggest that I might not. I haven't
tested yet and am a little unsure.
Any guidance would be appreciated.
John
--
Regards
John McMahon
li...@jspect.fastmail.fm
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users