Re: Specifying table names -
10-16-2003
, 02:59 PM
James,
you can prefix column name with the table name if you have identical columns
in the 2 different table
that you are using in query.
See following example on northwind database on SQL Server.
use northwind
go
select a.customerid, b.customerid
from customers a join orders b
on a.customerid = b.customerid
--The above query is as good as
select a.customerid, b.customerid
from customers a ,orders b
where a.customerid = b.customerid
Just remember you will have to prefix the column name with the required
table name alias or table name.
(But if you are using alias for the tables then you will have to prefix
column names with alias only and not table name)
In above examples im using alias for the tables you, can replace alias with
the table names as well. Which will
turn above query as
select customers.customerid, orders.customerid
from customers ,orders
where customers.customerid = orders.customerid
Search in Books online for following topic which will answer almost all of
your questions.
"SELECT Examples"
--
-Vishal |