I have Two tables in my POSTGRES DATABASE,
1. Student
2. Library_Student_Info
I want to Join the two tables and Update the 'Library_Student_Info' table with matched records. I am using the following Query
UPDATE Library_Student_Info SET Name = (
SELECT Name
FROM Student WHERE Student_ID= Library_Student_Info.Student_ID
LIMIT 1);
Anybody Can Help me ???
And also this i tried but Error..
UPDATE Library_Student_Info EM SET Name = (SELECT Name FROM Student DIR WHERE
DIR.Student_ID = EM.Student_ID AND
EM.Student_ID IS NOT NULL)
Update with Select Query
Moderator: General Moderators
- scorphus
- Forum Regular
- Posts: 589
- Joined: Fri May 09, 2003 11:53 pm
- Location: Belo Horizonte, Brazil
- Contact:
A WHERE clause should be missing:
What is the error message returned by Postgre?
Scorphus.
Code: Select all
UPDATE Library_Student_Info SET Name = (
SELECT Name
FROM Student WHERE Student_ID= Library_Student_Info.Student_ID
LIMIT 1) WHERE Name = '_null' OR <something>;Scorphus.