Greetings,
I used to do this kind of query in Ingres, where I concatenate
(+)various fields as one field and search accordingly.
Is there an equivalent method in SQL server ?
SELECT a.rsrcid,a.rsrc hqnumber,c.pers lastname,c.pers firstname,
b.asgtid,b.asgt actualstartdate ,b.asgtactualen ddate,
CASE b.enumstate
WHEN '2' THEN 'Running'
WHEN '3' THEN 'Cancelled'
WHEN '4' THEN 'Closed'
WHEN '6' THEN 'Open'
END AS status
FROM pblocal.dbo.res ources a
INNER JOIN pblocal.dbo.ass ignments b ON b.asgtrsrcguid = a.rsrcguid
INNER JOIN pblocal.dbo.per sons c ON c.persguid = a.rsrcpersguid
WHERE a.rsrcid+a.rsrc hqnumber+c.pers lastname+c.pers firstname not in
(SELECT e.rsrcid+e.rsrc hqnumber+g.pers lastname+g.pers firstname
FROM dtlocal.dbo.res ources e
INNER JOIN dtlocal.dbo.ass ignments f ON f.asgtrsrcguid = e.rsrcguid
INNER JOIN dtlocal.dbo.use rs h ON h.userguid = e.rsrcuserguid
INNER JOIN dtlocal.dbo.per sons g ON g.persguid = h.userpersguid)
I used to do this kind of query in Ingres, where I concatenate
(+)various fields as one field and search accordingly.
Is there an equivalent method in SQL server ?
SELECT a.rsrcid,a.rsrc hqnumber,c.pers lastname,c.pers firstname,
b.asgtid,b.asgt actualstartdate ,b.asgtactualen ddate,
CASE b.enumstate
WHEN '2' THEN 'Running'
WHEN '3' THEN 'Cancelled'
WHEN '4' THEN 'Closed'
WHEN '6' THEN 'Open'
END AS status
FROM pblocal.dbo.res ources a
INNER JOIN pblocal.dbo.ass ignments b ON b.asgtrsrcguid = a.rsrcguid
INNER JOIN pblocal.dbo.per sons c ON c.persguid = a.rsrcpersguid
WHERE a.rsrcid+a.rsrc hqnumber+c.pers lastname+c.pers firstname not in
(SELECT e.rsrcid+e.rsrc hqnumber+g.pers lastname+g.pers firstname
FROM dtlocal.dbo.res ources e
INNER JOIN dtlocal.dbo.ass ignments f ON f.asgtrsrcguid = e.rsrcguid
INNER JOIN dtlocal.dbo.use rs h ON h.userguid = e.rsrcuserguid
INNER JOIN dtlocal.dbo.per sons g ON g.persguid = h.userpersguid)
Comment