identical field names in 2 different tables
am 03.08.2005 13:14:36 von Steve
I am carrying out an INNER JOIN on 2 tables which share some common
field names.
When it comes to displaying the data in the recordset, how can I
distinguish between the fields? i.e. how I can I specify which
particular field I want to be displayed.
I tried syntax such as:
response.write objrs("tablename.fieldname") but this failed
Any ideas?
Thank you.
Re: identical field names in 2 different tables
am 03.08.2005 13:22:25 von reb01501
steve wrote:
> I am carrying out an INNER JOIN on 2 tables which share some common
> field names.
>
> When it comes to displaying the data in the recordset, how can I
> distinguish between the fields? i.e. how I can I specify which
> particular field I want to be displayed.
>
> I tried syntax such as:
>
> response.write objrs("tablename.fieldname") but this failed
>
You have to alias the columns in the select statement:
select t1.col t1col, t2.col t2col from
table1 t1 join table2 t2 ...
Hopefully, you aren't deliberately returning the columns used establish the
join. That would be a definite waste of resources: avoid returning duplicate
data. The only exception is if your query is using outer joins.
And if you are using selstar ...
http://www.aspfaq.com/show.asp?id=2096
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"