Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Joining 3 tables

Author  Topic 

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2003-01-06 : 23:01:22
Is there way to join 3 tables so I can easiy compaire info between all 3 of them.

--
For those with wings, fly to your dreams

It is all or nothing there is no in-between

Remember who I was... For me

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-01-06 : 23:45:16
quote:

Is there way to join 3 tables so I can easiy compaire info between all 3 of them.

--
For those with wings, fly to your dreams

It is all or nothing there is no in-between

Remember who I was... For me


Yes u can very well join three tables provided they have proper relationships defined between them.

Expect the UnExpected
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2003-01-06 : 23:49:40
Well I can realate each to on of the tables but one does not have anything in comman with another. Can it still be done?

--
For those with wings, fly to your dreams

It is all or nothing there is no in-between

Remember who I was... For me
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-01-07 : 00:05:44
We are not psychic. Can you post some table definitions and data so we know what you are trying to do ?

Damian
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2003-01-07 : 00:11:03
Sorry, Ok I have 3 tables. Knownmoves, moves, and stats. The table knownmoves has 3 coulmns "movename" "level" and "playerid". moves has tables "movename" "level" "st" "def" "life" "agil" "ki" and table stats has "playerid" "st" "def" "life" "agil" and "ki"

What I am tying to do is write an ASP script taht looks at knownmoves to see if they know a move in the moves table. and if there is something in moves they don't know it then looks at stats to see if the meet the stats requirements to learn it.

Hope that is not too confusing.

--
For those with wings, fly to your dreams

It is all or nothing there is no in-between

Remember who I was... For me
Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2003-01-07 : 08:34:59
quote:

Sorry, Ok I have 3 tables. Knownmoves, moves, and stats. The table knownmoves has 3 coulmns "movename" "level" and "playerid". moves has tables "movename" "level" "st" "def" "life" "agil" "ki" and table stats has "playerid" "st" "def" "life" "agil" and "ki"

What I am tying to do is write an ASP script taht looks at knownmoves to see if they know a move in the moves table. and if there is something in moves they don't know it then looks at stats to see if the meet the stats requirements to learn it.




This assumes that you are applying things retroactively, if you are cheking every time a player changes any stat you can probably change the => signs to =

I'm also unsure where level comes into play.

SELECT movename FROM moves
inner join stats on
stats.st => moves.st and
stats.def => moves.def and
stats.life => moves.life and
stats.agil => moves.agil and
stats.ki => moves.ki -- <-- all the moves a player can learn
left outer join knownmoves km on
stats.playerid = km.playerid and
noves.movename = km.movename
where km.movename is null
and stats.playerid = @theplayeridyouwant

-------
Moo.
Go to Top of Page
   

- Advertisement -