update students set college_name = c.name from colleges c
where students.city = c.city
weired SQL but awesome isn't??!!
> In update we cannot use aliases for the update table so have to use the full name in case of ambiguous columns e.g. city
> we can have any number of from tables with aliases and have a join on the update table and also can update a value using a value from the join table
where students.city = c.city
weired SQL but awesome isn't??!!
> In update we cannot use aliases for the update table so have to use the full name in case of ambiguous columns e.g. city
> we can have any number of from tables with aliases and have a join on the update table and also can update a value using a value from the join table
No comments:
Post a Comment