这是我的问题
select PhoneNumber as _data,PhoneType as _type from contact_phonenumbers where ContactID = 3 and Type = 'R' and PT = 'M'
union
SELECT EmailID,Type from contact_emails where ContactID = 3 and Type = 'P'
UNION
SELECT EmailID,Type from contact_emails where ContactID = 3 and Type = 'O' 在这里,我的问题是我只需要从每个select语句中提取一行。是否可以通过"limit“来获取它。
发布于 2012-03-17 18:06:40
根据MySQL网站,您可以像这样对单个选择应用限制
(SELECT a FROM t1 WHERE a=10 AND B=1 ORDER BY a LIMIT 10)
UNION
(SELECT a FROM t2 WHERE a=11 AND B=2 ORDER BY a LIMIT 10);https://stackoverflow.com/questions/9749050
复制相似问题