Create an Account
username: password:
 
  MemeStreams Logo

MySQL AB :: MySQL 5.0 Reference Manual :: 12.2.8.7 Correlated Subqueries

search

Lost
Picture of Lost
My Blog
My Profile
My Audience
My Sources
Send Me a Message

sponsored links

Lost's topics
Arts
Business
Games
Health and Wellness
Home and Garden
Miscellaneous
Current Events
Recreation
Local Information
Science
Society
Sports
Technology

support us

Get MemeStreams Stuff!


 
MySQL AB :: MySQL 5.0 Reference Manual :: 12.2.8.7 Correlated Subqueries
Topic: Miscellaneous 2:21 am EST, Nov 28, 2007

12.2.8.7. Correlated Subqueries

A correlated subquery is a subquery that contains a reference to a table that also appears in the outer query. For example:

SELECT * FROM t1 WHERE column1 = ANY
(SELECT column1 FROM t2 WHERE t2.column2 = t1.column2);

Notice that the subquery contains a reference to a column of t1, even though the subquery's FROM clause does not mention a table t1. So, MySQL looks outside the subquery, and finds t1 in the outer query.

VERY useful if say... someone makes a table field an ENUM when it should be another table or individual boolean fields.

MySQL AB :: MySQL 5.0 Reference Manual :: 12.2.8.7 Correlated Subqueries



 
 
Powered By Industrial Memetics
RSS2.0