|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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 ![]() ![]()
|
|
#3
|
|||
|
|||
|
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: '' |
|
#4
|
||||
|
||||
|
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 |
|
#5
|
|||
|
|||
|
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 %> |
|
#6
|
||||
|
||||
|
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. |
|
#7
|
|||
|
|||
|
Line 156 is
SET RS = oConn.Execute(sqlString) |
|
#8
|
|||
|
|||
|
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. |
|
#9
|
|||
|
|||
|
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. ![]() |
|
#10
|
|||
|
|||
|
Use * in Access
S- |
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > Joining Tables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|