sql - First and Last names in a table do not match with ID's -
hello here issue. (transact-sql)
i have 2 tables, table 1 main table, , has student id's, , first , last names associated (studentid, first name, last name)
table 2 has students failing scores. issue is, first , last names of students not matched id's, in, entire studentid column blank(full of null values, because blank). (the first , last names correct, , in table 2)
how write sort of query(or update) permanently fill column in correct id's. (again, first name, last name, , matching id columns available in table 1)
if easier can merge first , last name column, prefer leave them way.
thank you!
you can use update
query from
join tables. big caveat here break if have more 1 person sharing same name.
update t2 set t2.id = t1.id table2 t2 inner join table1 t1 on t2.firstname = t1.firstname , t2.lastname = t1.lastname