mysql关联操作



select a.uid1,b.uid,a.uid1,b.name,a.uid2,c.uid,a.uid2,c.name

from A表 a,B表 b,B表 c

where a.uid1=b.uid(+) and a.uid2 = c.uid(+)



SELECT * FROM film JOIN film_actor ON (film.film_id = film_actor.film_id)

SELECT * FROM film JOIN film_actor USING (film_id)

SELECT * FROM film, film_actor WHERE film.film_id = film_actor.film_id



SELECT * FROM film, film_actor WHERE film.film_id = film_actor.film_id AND actor_id = 17 AND film.length > 120


SELECT * FROM film JOIN film_actor ON (film.film_id = film_actor.film_id) WHERE actor_id = 17 AND film.length > 120


SELECT * FROM film JOIN film_actor USING (film_id) WHERE actor_id = 17 AND film.length > 120


SELECT film.title, film_id FROM film JOIN film_actor USING (film_id) WHERE actor_id = 17 AND film.length > 120;


SELECT film.title, film_id FROM film JOIN film_actor ON (film.film_id = film_actor.film_id) WHERE actor_id = 17 AND film.length > 120;ERROR 1052 (23000): Column 'film_id' in field list is ambiguous

相关文章