Jump to content

Fieldnames not unique with MSSQL


Recommended Posts

When I execute the following SQL statement : select IT.ITEMID, IT.ITEMNAME, IT.ITEMNAMEFR, IT.ITEMSTRUCT, IT.ITEMSTRUCT2_, IT.ITEMSTRUCT3_, IT.ITEMSTRUCT4_, IT.ITEMSTRUCT5_, IT.ITEMSTRUCT6_, ist5.DESCRIPTIONFRBE, ist5.DESCRIPTIONNLBE, ist5.DESCRIPTIONENGB, ist5.DESCRIPTIONDE, ist6.DESCRIPTIONFRBE, ist6.DESCRIPTIONNLBE, ist6.DESCRIPTIONENGB, ist6.DESCRIPTIONDE from InventTable as it join itemStructTable as ist5 on ist5.structLevelType = '5' and ist5.structLevelID = it.itemStruct5_ join itemStructTable as ist6 on ist6.structLevelType = '6' and ist6.structLevelID = it.itemStruct6_ When I print the result of the array ( via print_r(mssql_fetch_array($this->recordSet, 'MSSQL_BOTH) , the recordset is set as follows : $this->recordSet = mssql_query($sqlStatement, $this->connection); ), I get the following result : Array ( [iTEMID] => 31-0030-0347 [iTEMNAME] => Rubberdoeken Ruby UV 1,70 : 330 x 1000 mm [iTEMNAMEFR] => Blanchets Ruby UV 1,70 : 330 x 1000 mm [iTEMSTRUCT] => T [iTEMSTRUCT2_] => 31 [iTEMSTRUCT3_] => 3100 [iTEMSTRUCT4_] => 310030 [iTEMSTRUCT5_] => 310030100 [iTEMSTRUCT6_] => 310095 [DESCRIPTIONFRBE] => Ruby UV 1,70 [DESCRIPTIONNLBE] => Ruby UV 1,70 [DESCRIPTIONENGB] => Ruby UV 1,70 [DESCRIPTIONDE] => Ruby UV 1,70 ) The prefixes for the table names are not present, so I only get one set of descriptions instead of two. Is there a way to force PHP or MSSQL to give me the exact fieldnames I used in my select ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...