MSSQL STOREDPROC SELECTING FROM A FIELD FROM 1 TABLE USING LIKE TO CREATE MORE THAN 1 COLUM IN A DAT
- by djshortbus
I have a ASPX.NET DataGrid and im trying to USE a select LIKE 'X'% from a table that has 1 field called location. im trying to display the locations that start with a certain letter (example wxxx,axxx,fxxx,) in different columns in my data grid.
SELECT
DISTINCT LM.LOCATION AS '0 LOCATIONS' ,
LM.COUNTLEVEL AS 'COUNTLEVEL'
FROM SOH S WITH(NOLOCK)
JOIN LOCATIONMASTER LM ON LM.LMID = S.LMID
WHERE
LM.COUNTLEVEL = 1 AND
LM.LOCATION NOT IN ('RECOU','PROBLEM','TOSTOCK','PYXVLOC')
AND LM.LOCATION LIKE '0%'
SELECT
DISTINCT LM.LOCATION AS 'A LOCATIONS' ,
LM.COUNTLEVEL AS 'COUNTLEVEL'
FROM SOH S WITH(NOLOCK)
JOIN LOCATIONMASTER LM ON LM.LMID = S.LMID
WHERE
LM.COUNTLEVEL = 1 AND
LM.LOCATION NOT IN ('RECOU','PROBLEM','TOSTOCK','PYXVLOC')
AND LM.LOCATION LIKE 'A%'