SQL Inner-join with 3 tables?

You can do the following (I guessed on table fields,etc) SELECT s.studentname , s.studentid , s.studentdesc , h.hallname FROM students s INNER JOIN hallprefs hp on s.studentid = hp.studentid INNER JOIN halls h on hp.hallid = h.hallid Based on your request for multiple halls you could do it this way. You just join on your … Read more

Update statement with inner join on Oracle

That syntax isn’t valid in Oracle. You can do this: UPDATE table1 SET table1.value = (SELECT table2.CODE FROM table2 WHERE table1.value = table2.DESC) WHERE table1.UPDATETYPE=’blah’ AND EXISTS (SELECT table2.CODE FROM table2 WHERE table1.value = table2.DESC); Or you might be able to do this: UPDATE (SELECT table1.value as OLD, table2.CODE as NEW FROM table1 INNER JOIN … Read more

INNER JOIN ON vs WHERE clause

INNER JOIN is ANSI syntax that you should use. It is generally considered more readable, especially when you join lots of tables. It can also be easily replaced with an OUTER JOIN whenever a need arises. The WHERE syntax is more relational model oriented. A result of two tables JOINed is a cartesian product of … Read more