× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.

What I'm trying to do here is clear though my syntax is wrong.
What's correct for the UPDATE statement?

create table table1( A int, B int, C int);
create table table2( A int, B int, C int, D int);
insert into table1 (A,B,C) values(1,1,99);
insert into table2 (A,B,C,D) values(1,1,15,27),(1,1,3,13);

UPDATE table2
SET table2.C = table1.C
WHERE table2.A = table1.A
AND table2.B = table1.B
AND table2.D = (SELECT MAX(D)
FROM table2 dd
WHERE dd.A = table1.A
AND dd.B = table1.B
GROUP BY dd.A, dd.B);

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2023 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.