开发者

Explain a SELECT statement for MySQL

someone can explain me what this query does?

$sql=mysql_query("SELECT b.id, b.data FROM data_parent a, data b WHERE b.id=a.did and parent='$id'");

it works but honestly i didn't unde开发者_运维百科rstand.

Thanks


  1. Take the table data_parent and alias it as a.
  2. Take the table data and alias it as b.
  3. Match values in a with those in b on the id column in b and the did column in a.
  4. Filter for rows in [some table since it isn't specified] such that the column parent is equal to some passed in value.
  5. From those results, display the id and data columns from b


The query grabs the COlumns ID & Data from the Data table where the data_parentID is the same as the data table id. And it is based on for 1 parent ID

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜