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 2008 Forums
 Transact-SQL (2008)
 Query to pull out a drop list of items

Author  Topic 

slifin
Starting Member

1 Post

Posted - 2010-07-28 : 15:00:50
hi there, to give you some context of my problem

I have a basic item table which includes the item's name in one column and a ID for the item in another column

and I have a monsterset table that has a drop list in columns sItem01, sItem02, sItem03, sItem04 etc which contain the ids of the items

here is my query so far

quote:
SELECT monsterset.sZone, MONSTER.strName,

monsterset.sItem01 AS item1,
monsterset.sItem02 AS item2,
monsterset.sItem03 AS item3,
monsterset.sItem04 AS item4


FROM MONSTER INNER JOIN
monsterset ON MONSTER.sSid = monsterset.sTableNum
INNER JOIN
BASICITEM ON monsterset.sItem01 = BASICITEM.sNum


WHERE (MONSTER.sClass = '10')


I want to modify the query so it doesn't just return the item's ID but the item's name instead, for each drop list

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-07-28 : 15:15:55
This probably?
SELECT monsterset.sZone, MONSTER.strName,
monsterset.sItem01 AS item1,
monsterset.sItem02 AS item2,
monsterset.sItem03 AS item3,
monsterset.sItem04 AS item4,
BASICITEM.itemname
FROM MONSTER
INNER JOIN monsterset ON MONSTER.sSid = monsterset.sTableNum
INNER JOIN BASICITEM ON monsterset.sItem01 = BASICITEM.sNum
WHERE (MONSTER.sClass = '10')

You are just joining Item01 with BASICITEM.sNum? Should you also be joining sItem02,sItem03,sItem04 as well?
Go to Top of Page
   

- Advertisement -