如何检查前1000行中是否存在值,以及它是否确实返回信息。
像
这样的东西select cme_fbid
from table1 if exists(select cme_fbid from table1 limit 1000)
答案 0 :(得分:1)
SELECT
CASE
WHEN EXISTS(SELECT cme_fbid FROM table1 LIMIT 1000) THEN t.cme_fbid
ELSE NULL
END
FROM table1 t
答案 1 :(得分:1)
select cme_fbid
from table1
where cme_fbid in (
select cme_fbid
from table1
limit 1000)
您可能希望在内部查询中添加order by
以获得一致/有意义的结果。
答案 2 :(得分:1)
使用子查询来限制您查看的数据:
select cme_fbid
from (select * from table1 order by someThing limit 1000) x
where someField = someValue
答案 3 :(得分:0)
select count(*) as cnt from table1 where cme_fbid is not null and cme_fbid <> 0 limit 1000 order by id
或在
上使用mysql_row_count
select cme_fbid from table1 where cme_fbid is not null and cme_fbid <> 0 limit 1000 order by id