J*******r 发帖数: 2945 | 1 SELECT PLAYERNO, TOWN, STREET
FROM PLAYERS
WHERE (TOWN, STREET) IN
(('Stratford','Haseltine Lane'),
('Stratford','Edgecombe Way'));
这种语法在MySQL上能跑,在SQL Server上跑不了,好像不支持同时返回两个值,怎么
改最简单?谢谢 | c*********e 发帖数: 16335 | 2 SELECT PLAYERNO, TOWN, STREET
FROM PLAYERS
WHERE TOWN IN ('Stratford') AND STREET IN ('Haseltine Lane','Edgecombe
Way');
【在 J*******r 的大作中提到】 : SELECT PLAYERNO, TOWN, STREET : FROM PLAYERS : WHERE (TOWN, STREET) IN : (('Stratford','Haseltine Lane'), : ('Stratford','Edgecombe Way')); : 这种语法在MySQL上能跑,在SQL Server上跑不了,好像不支持同时返回两个值,怎么 : 改最简单?谢谢
| n****e 发帖数: 1403 | 3 what if TOWN is Stratford and any other?
【在 c*********e 的大作中提到】 : SELECT PLAYERNO, TOWN, STREET : FROM PLAYERS : WHERE TOWN IN ('Stratford') AND STREET IN ('Haseltine Lane','Edgecombe : Way');
| e****7 发帖数: 4387 | 4 tsql sucks on this one!
-------------------
WITH TMP_SET AS
(
SELECT 'Stratford' AS TOWN,'Haseltine Lane' AS STREET
UNION
SELECT 'Stratford','Edgecombe Way'
)
SELECT PLAYERS.PLAYERNO, PLAYERS.TOWN, PLAYERS.STREET
FROM PLAYERS JOIN TMP_SET T
ON PLAYERS.TOWN = T.TOWN AND PLAYERS.STREET = T.STREET | c*********e 发帖数: 16335 | 5 仔细看lz的帖子。逻辑搞清楚先。
【在 n****e 的大作中提到】 : what if TOWN is Stratford and any other?
|
|