By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,313 Members | 2,725 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,313 IT Pros & Developers. It's quick & easy.

Select from two tables

P: n/a
after selecting from two table like so-

select table1.column, table2.column from table1, table2 ...

What is the correct syntax to access the individual table data?

With one table I would normally just use- rs("column")

TIA
Jul 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
same thing. If you have mitiple columns with the same name select by using
rs(x) where x is the index of the column in the select.

Mike

"Taper Litwater" <Li******@NOSPAM.com> wrote in message
news:ul**************@TK2MSFTNGP10.phx.gbl...
after selecting from two table like so-

select table1.column, table2.column from table1, table2 ...

What is the correct syntax to access the individual table data?

With one table I would normally just use- rs("column")

TIA

Jul 19 '05 #2

P: n/a


Thank you :-)

"Mike" <Mi**@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
same thing. If you have mitiple columns with the same name select by using rs(x) where x is the index of the column in the select.

Mike

"Taper Litwater" <Li******@NOSPAM.com> wrote in message
news:ul**************@TK2MSFTNGP10.phx.gbl...
after selecting from two table like so-

select table1.column, table2.column from table1, table2 ...

What is the correct syntax to access the individual table data?

With one table I would normally just use- rs("column")

TIA


Jul 19 '05 #3

P: n/a
On Mon, 27 Oct 2003 11:03:08 -0800, "Taper Litwater"
<Li******@NOSPAM.com> wrote:
after selecting from two table like so-

select table1.column, table2.column from table1, table2 ...

What is the correct syntax to access the individual table data?

With one table I would normally just use- rs("column")

TIA


If both tables contain rows with the same name, you need to alias at
least one of them. The recordset object does not know where the
columns come from, so referencing them as table.column at that point
is not possible.

select table1.column as t1c, table2.column as t2c from table1,
table2...

Then in your recordset object, use...

rs("t1c") and rs("t2c")

Jul 19 '05 #4

P: n/a
<snip>
If you are returning the same column name from multiple joined tables, then
you have one of two problems.

(A) Either both columns mean the same thing, and contain the same data --
therefore your query is redundant and inefficient and there's no reason to
access both columns in ASP (or return them with the resultset in the first
place).

(B) Or, you chose extremely poor names for your columns. If they don't mean
the
same thing, and contain distinct data, then why do they have the same name?
</snip>

My suggestion is to fix that problem... either by eliminating redundant
columns from the SELECT statement in case (A), or by aliasing the columns in
the SELECT (or properly altering the table(s)) in case (B).
"Taper Litwater" <Li******@NOSPAM.com> wrote in message
news:ul**************@TK2MSFTNGP10.phx.gbl...
after selecting from two table like so-

select table1.column, table2.column from table1, table2 ...

What is the correct syntax to access the individual table data?

With one table I would normally just use- rs("column")

TIA

Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.