MSSQL STOREDPROC SELECTING FROM A FIELD FROM 1 TABLE USING LIKE TO CREATE MORE THAN 1 COLUM IN A DAT
Posted
by djshortbus
on Stack Overflow
See other posts from Stack Overflow
or by djshortbus
Published on 2010-05-22T05:50:19Z
Indexed on
2010/05/22
6:00 UTC
Read the original article
Hit count: 291
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%'
© Stack Overflow or respective owner