Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 21st, 2005, 12:16 PM
lewis lewis is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 7 lewis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 17 m 43 sec
Reputation Power: 0
Joining Tables

I hve three tables STATS05, STATS04, STATS03 and want to call in the data from all the tables when the user selects a name from the list of players <%=playername>.

I have got it to work with just the STATS05 option but someone said I could pull in the other data using join or something.

Anyone able to comment/help.

Thanks

Reply With Quote
  #2  
Old February 21st, 2005, 01:09 PM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,181 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 96918 Folding Title: Advanced FolderFolding Points: 96918 Folding Title: Advanced FolderFolding Points: 96918 Folding Title: Advanced FolderFolding Points: 96918 Folding Title: Advanced FolderFolding Points: 96918 Folding Title: Advanced Folder
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 19 m 32 sec
Reputation Power: 699
Hi,

take this for example

table1
table1id, name, surname

table2
table2id, address, postalcode

table3
table3id, phonenumber, email

where table1,table2 and table3id is equal to one one another.

then you would use something like this to select data from all 3 tables
Code:
 strSQL = "select * from table1 inner join table2 " &_
 "on table1.table1id = table2.table2id " &_
 "inner join table3 " &_
 "on table1.tableid = table3.table3id " &_
 "where table1.name like '%" & playername & "%'"
 


hope this helps
__________________
Look! Its a ShemZilla



Reply With Quote
  #3  
Old February 22nd, 2005, 02:45 PM
lewis lewis is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 7 lewis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 17 m 43 sec
Reputation Power: 0
I used the following sql script

"SELECT *, goals2004 + assists2004 as total04 FROM player inner join playerold on player.playernumber = playerold.playernumber WHERE player.playername LIKE '%" & playername & "%'"

but get the error message

Object required: ''

Reply With Quote
  #4  
Old February 23rd, 2005, 12:30 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,181 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 96918 Folding Title: Advanced FolderFolding Points: 96918 Folding Title: Advanced FolderFolding Points: 96918 Folding Title: Advanced FolderFolding Points: 96918 Folding Title: Advanced FolderFolding Points: 96918 Folding Title: Advanced Folder
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 19 m 32 sec
Reputation Power: 699
Hi Lewis,

try this

Code:
"SELECT *, (goals2004 + assists2004) as total04 FROM player inner join playerold on player.playernumber = playerold.playernumber WHERE player.playername LIKE '%" & playername & "%'"


hope this helps

Reply With Quote
  #5  
Old February 23rd, 2005, 07:00 AM
lewis lewis is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 7 lewis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 17 m 43 sec
Reputation Power: 0


Microsoft VBScript runtime error '800a01a8'

Object required: '' /teams/asp/detail05a.asp, line 156

% sqlString = "SELECT *, (playerold.goals2004 + playerold.assists2004) as total04 FROM player inner join playerold on player.playernumber = playerold.playernumber WHERE player.playername LIKE '%" & playername & "%'"

SET RS = oConn.Execute(sqlString)

WHILE NOT RS.EOF

%>


Reply With Quote
  #6  
Old February 23rd, 2005, 07:31 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,181 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 96918 Folding Title: Advanced FolderFolding Points: 96918 Folding Title: Advanced FolderFolding Points: 96918 Folding Title: Advanced FolderFolding Points: 96918 Folding Title: Advanced FolderFolding Points: 96918 Folding Title: Advanced Folder
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 19 m 32 sec
Reputation Power: 699
Change this line

Code:
 SET RS = oConn.Execute(sqlString)
 to
 set rs = Server.CreateObject("ADODB.Recordset")
 rs.open sqlString, oConn


what is line 156?

also response.write sqlString and put it into your query analyzer and see what happens.

Last edited by nofriends : February 23rd, 2005 at 07:39 AM.

Reply With Quote
  #7  
Old February 23rd, 2005, 08:13 AM
lewis lewis is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 7 lewis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 17 m 43 sec
Reputation Power: 0
Line 156 is


SET RS = oConn.Execute(sqlString)


Reply With Quote
  #8  
Old February 23rd, 2005, 09:50 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
What DB engine are you using? (not all DB use % as the wildcard)

S-
__________________
If you have found a particular post helpful, show your appreciation by adding reputation points to that user by clicking the "scales" image in the upper right had corner of their post.

Reply With Quote
  #9  
Old February 23rd, 2005, 10:02 AM
lewis lewis is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 7 lewis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 17 m 43 sec
Reputation Power: 0
I use MS Access database. My other standard scripts work fine like calling individual records etc but for some reason this doesnt.

Quite a newbie to ASP as you can tell.

Reply With Quote
  #10  
Old February 23rd, 2005, 10:51 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Use * in Access

S-

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Joining Tables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway