Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-23-2006, 10:08 PM   PM User | #1
parallon
Regular Coder

 
Join Date: May 2005
Posts: 215
Thanks: 14
Thanked 0 Times in 0 Posts
parallon is an unknown quantity at this point
multiple tables

Hello all. I was just wondering whether it is possible to have data from 2 differrent database tables in the same form table, or do I need to create another form table?

Thanks,

Parallon
parallon is offline   Reply With Quote
Old 02-23-2006, 10:12 PM   PM User | #2
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,472
Thanks: 4
Thanked 40 Times in 40 Posts
Brandoe85 will become famous soon enough
Can you explain in more detail? I don't quite understand.

Thanks,
__________________
-Brando
Why using tables for eating is stupid!
Brandoe85 is offline   Reply With Quote
Old 02-23-2006, 10:28 PM   PM User | #3
parallon
Regular Coder

 
Join Date: May 2005
Posts: 215
Thanks: 14
Thanked 0 Times in 0 Posts
parallon is an unknown quantity at this point
Well, the program that I am working on generates a report which has a section called 'Estimates'. Well in this section, there is a list of Equipment with data pertaining to each piece of equipment, i.e. description, type, cost, etc. (All from the same table)... I am trying to add one more bit of information, but this info is coming from a different table in the database. I was just wondering if it is possible to include that data in the same row as the other relevant information? I would post the code, but there are about 820 lines.

Thanks,

Parallon
parallon is offline   Reply With Quote
Old 02-23-2006, 10:39 PM   PM User | #4
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,472
Thanks: 4
Thanked 40 Times in 40 Posts
Brandoe85 will become famous soon enough
Do these 2 tables relate so you could use a join? What DBMS are you using?
__________________
-Brando
Why using tables for eating is stupid!
Brandoe85 is offline   Reply With Quote
Old 02-23-2006, 11:05 PM   PM User | #5
parallon
Regular Coder

 
Join Date: May 2005
Posts: 215
Thanks: 14
Thanked 0 Times in 0 Posts
parallon is an unknown quantity at this point
I really appreciate your effort, but the easiest thing that I think that I could do is to attach the file. BTW, this is a SQL database. What I am trying to do is use the field "Room" from a table called 'Equipment', and associate it to the appropriate equipment. The other fields in this section are coming from a table called 'WOtools'. I have created a space where I need the data on line 427. I am not asking for you to do it for me, but if you could just point me in the right direction.

Thanks,

Parallon
Attached Files
File Type: zip Worpt2_test.zip (4.1 KB, 133 views)
parallon is offline   Reply With Quote
Old 02-24-2006, 06:13 PM   PM User | #6
parallon
Regular Coder

 
Join Date: May 2005
Posts: 215
Thanks: 14
Thanked 0 Times in 0 Posts
parallon is an unknown quantity at this point
Ok, here is the portion getting some of the information:

Code:
sSQL = "SELECT * FROM WOTools WHERE KeyNum = '" & wonum & "' AND Estimate <> 0 ORDER BY Equipment"
Set rsTool = conn.Execute(sSQL)
What I need also is to get the record from Equipment.Room. Both the Equipment and WOTools tables have a field called Equipment. Could I just use a LEFT JOIN to get this information also?

Thanks,

Parallon
parallon is offline   Reply With Quote
Old 02-27-2006, 08:38 PM   PM User | #7
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,472
Thanks: 4
Thanked 40 Times in 40 Posts
Brandoe85 will become famous soon enough
Depends what kind of matches you need. Either INNER join or a LEFT join. Heres an article on joins:
http://www.w3schools.com/sql/sql_join.asp

Let us know how it goes.

Good luck;
__________________
-Brando
Why using tables for eating is stupid!
Brandoe85 is offline   Reply With Quote
Old 02-27-2006, 08:45 PM   PM User | #8
parallon
Regular Coder

 
Join Date: May 2005
Posts: 215
Thanks: 14
Thanked 0 Times in 0 Posts
parallon is an unknown quantity at this point
Thank you for your effort. I finally got it with the following method:

Code:
sSQL = "SELECT WOTools.*, Equipment.Room FROM WOTools LEFT JOIN Equipment ON WOTools.Equipment = Equipment.Equipment WHERE KeyNum = '" & wonum & "' AND Estimate <> 0 ORDER BY Room"
Once again, thank you all.

Parallon
parallon is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:10 PM.


Advertisement
Log in to turn off these ads.