473,498 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jul 19 '05 #1
4 5009
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


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
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
<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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
12532
by: mfyahya | last post by:
I have two tables, both containing an 'authors' column. Is there a way to get a unique list of authors from the two tables? I tried SELECT DISTINCT `authors` from `table1`, `table2`; but I got an...
1
11549
by: Ahmet Karaca | last post by:
Hi. myds.Reset(); mycommand.SelectCommand.CommandText= "Select att1 from Ing as Ingredient, Pro as Product "+ "where Pro.ad='apple' and Pro.id=Ing.id"; mycommand.Fill(myds, "Product"); // Here...
1
4018
by: Diffident | last post by:
Hello All, I am trying to filter rows in a datatable based on filtercriteria and sortcriteria using the datatable.select() method. I am encountering a strange behavior in this process. Here is...
4
5654
by: VK | last post by:
Hello, I have a dataset which has one datatable in it. The dt has over 3000 rows in it. Now I would like to get the rows where the StartDate is 15 Feb 2005, so I did the following: ...
7
2981
by: Matt Jensen | last post by:
Howdy Fairly simple question I think, I presume the answer is no it can't be reused for 2 *SELECT* statements, but just hoping for clarification. Just asking in the interests of trying to minimise...
33
6603
by: Peter | last post by:
People are telling me it is bad to put select * from <atable> in a view. I better should list all fields of the table inside the definition of the view. I dont know exactly why but some...
4
7174
by: Chris | last post by:
Can't seem to figure out how to do this and have been reading for some time now...... I want to select a row count from a table name in SYSTABLES. This statement does not return what I needed,...
10
1697
by: Richard Maher | last post by:
Hi, Sorry if this is one of those issues that people feel passionate about and I assure you I'm not trolling but rather seeking guidance on which way to go with the web browser presentation of...
3
25644
by: Jeff | last post by:
hey ..NET 2.0 I have a datatable which consist of 3 columns (int, date, value). This DataTable have 3 rows, the values of the "date" ("date" column is of datetime datatype) column is:...
0
1493
by: cmrhema | last post by:
Hi, I have two controls one html select control and one asp.net dropdownlist control. In html select control i have three maps loaded. It is loaded in the following manner. <SELECT...
0
7200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5460
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4904
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4586
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.