Ask a Question related to ASP, Design and Development.
-
Taper Litwater #1
Select from two tables
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
Taper Litwater Guest
-
Select Sum acrross tables
Hi, I have few different sales tables and I would like to know how I can write qeury that produces following results.. Tables=(sale.accom,... -
Select accoss 2 tables
Hi everyone, A bit stuck....and I will try to explain well. I have 2 tables in a MySQL database. In PHP I am trying to find the first... -
MySQL Q - SELECT with 2 tables
Message-ID: <acad69df.0309030913.330334ac@posting.google.com> from Marc contained the following: I don't think you've quite got the hang of... -
SELECT DISTINCT from two tables
Hi I have two table which are related: table1 holds personellinformation table2 holds nodeInformation The nodes in table2 can have a... -
Select quantity from 2 tables
I have 2 tables: table1: country1 quantity1 idProduct1 table2: country2 quantity2 idProduct2 Now I have to get the... -
Mike #2
Re: Select from two tables
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" <Litwater@NOSPAM.com> wrote in message
news:ulF9szLnDHA.2592@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
>
>
Mike Guest
-
Dan Brussee #3
Re: Select from two tables
On Mon, 27 Oct 2003 11:03:08 -0800, "Taper Litwater"
<Litwater@NOSPAM.com> wrote:
If both tables contain rows with the same name, you need to alias at>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
>
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")
Dan Brussee Guest
-
Taper Litwater #4
Re: Select from two tables
Thank you :-)
"Mike" <Mike@nospam.com> wrote in message
news:%23yU8P4LnDHA.2304@TK2MSFTNGP11.phx.gbl...using> same thing. If you have mitiple columns with the same name select by> rs(x) where x is the index of the column in the select.
>
> Mike
>
> "Taper Litwater" <Litwater@NOSPAM.com> wrote in message
> news:ulF9szLnDHA.2592@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
> >
> >
>
Taper Litwater Guest
-
Aaron Bertrand - MVP #5
Re: Select from two tables
<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" <Litwater@NOSPAM.com> wrote in message
news:ulF9szLnDHA.2592@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
>
>
Aaron Bertrand - MVP Guest



Reply With Quote

