I'm trying to get a grasp of mysql by learning from other scripts and how they work.
However as mysql querries get more complex, I start getting lost as to what happens and what it means.
db_query("SELECT d.*, u.userid FROM documents d LEFT JOIN users ON d.author = u.id WHERE d.text LIKE '%$docs%' ORDER BY d.timestamp DESC LIMIT 20");
This is the sample code from a documents table. What I don't understand is that the table contains columns of id, author, text, timestamp. But what does d.* mean? Why not just *, and d represents what? If it means the table, why does it have to identify it if FROM documents is already stated later? Basically, it would be nice if someone could explain this whole statement to me. I know...read the book...but I tried looking up SELECT and it doesn't have examples of this for me to read. Least I didn't find it. So would appreciate a terse explanation of this query.
TIA
However as mysql querries get more complex, I start getting lost as to what happens and what it means.
db_query("SELECT d.*, u.userid FROM documents d LEFT JOIN users ON d.author = u.id WHERE d.text LIKE '%$docs%' ORDER BY d.timestamp DESC LIMIT 20");
This is the sample code from a documents table. What I don't understand is that the table contains columns of id, author, text, timestamp. But what does d.* mean? Why not just *, and d represents what? If it means the table, why does it have to identify it if FROM documents is already stated later? Basically, it would be nice if someone could explain this whole statement to me. I know...read the book...but I tried looking up SELECT and it doesn't have examples of this for me to read. Least I didn't find it. So would appreciate a terse explanation of this query.
TIA