I am looking to update the first record when a duplicate is found in a table.
CREATE TABLE tblauthor
(
Col1 varchar(20),
Col2 varchar(30)
);
CREATE TABLE tblbook
(
Col1 varchar(20),
Col2 varchar(30),
Col3 varchar(30)
);
INSERT INTO tblAuthor
(Col1,Col2)
VALUES
('1', 'John'),
('2', 'Jane'),
('3', 'Jack'),
('4', 'Joe');
INSERT INTO tblbook
(Col1,Col2,Col3)
VALUES
('1', 'John','Book 1'),
('2', 'John','Book 2'),
('3', 'Jack','Book 1'),
('4', 'Joe','Book 1'),
('5', 'Joe','Book 2'),
('6', 'Jane','Book 1'),
('7', 'Jane','Book 2');
The update result I want to accomplish should update the records as follows. I would like tblbook.col3 = 1st.
select * from tblbook
('1', 'John','1st'),
('3', 'Jack','1st'),
('4', 'Joe','1st'),
('6', 'Jane','1st');
Can't seem to even get this done with distinct.