Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Most things that I tried gave me:#1066 - Not unique table/aliasAny help would be appreciated.Alexandre
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2010-11-18 : 13:03:47
i doubt if you're using MS SQL ServerIf its MS SQL Server below works
SELECT s.ID AS IDStore,cl1.City AS PhysCity,cl2.City AS CorrCityFROM Store sINNER JOIN CityList cl1ON cl1.ID = s.[IDPhysCity]INNER JOIN CityList cl2ON cl2.ID = s.[IDCorrCity]
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
alexandre_bastien
Starting Member
3 Posts
Posted - 2010-11-18 : 13:14:27
I'm testing it in phpMyAdmin on MySQL. The thing is that I only gave one CityList table, but I want to call it twice. Once for the IDPhysCity and once for the IDCorrCity.
alexandre_bastien
Starting Member
3 Posts
Posted - 2010-11-18 : 13:34:27
Ok, it worked perfectly! Thanks alot.
SELECT store.ID,cl1.city AS PhysCity,cl2.city AS CorrCityFROM storeINNER JOIN citylist AS cl1ON cl1.ID = store.IDCorrCityINNER JOIN citylist AS cl2ON cl2.ID = store.IDPhysCity
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2010-11-19 : 10:45:08
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/