Geoff Jones wrote:
> i.e. I'm a little puzzed by the "table1.id as table1_id" (the last bit)
>
> Is table1.id the primary key of table1? What is table1_id?
table1_id is just a alias for the id in table1. And the example assumed
that you have a table named table1 and table2 and both have column named
id as their primary key. Without the alias, your query would return just
two columns, both named as "id", so it would be harder for you to know
which id belongs to which table.
The name of alias is not much ruled, so you could say:
select
table1.id as cat,
table2.id as dog
And it would be as valid and working. But I like naming the aliases so
that you know the table and column from the name.
>> Stay informed about: identical rows