我用的上面这个SQL语句,想获取Student表中的Name和Sec列,还有获取这个表的总行数。但是我用sqlite3_exec执行该SQL语句后,回调函数却只执行了一次,然后就不再执行回调函数了。但是我的这个表格中是不止一行数据的,有几百行数据。
7 个解决方案
#1
没有这样用过,分两次调用吧,一次获取Name和Sec列,一次获取表的总行数。
#2
select name, sex, cnt from student, (select count(1) as cnt from student)
#3
SELECT Name, Sex, COUNT(1) FROM Student,它是总数
#4
SELECT Name, Sex, COUNT(1) FROM Student group by Name, Sex
#5
SELECT Name, Sex, COUNT(1) FROM Student group by Name, Sex
#6
查询语句中有聚合函数,就需要用group by
#7
建议楼主通读SQL Server中文版联机帮助。
#1
没有这样用过,分两次调用吧,一次获取Name和Sec列,一次获取表的总行数。
#2
select name, sex, cnt from student, (select count(1) as cnt from student)
#3
SELECT Name, Sex, COUNT(1) FROM Student,它是总数
#4
SELECT Name, Sex, COUNT(1) FROM Student group by Name, Sex
#5
SELECT Name, Sex, COUNT(1) FROM Student group by Name, Sex
#6
查询语句中有聚合函数,就需要用group by
#7
建议楼主通读SQL Server中文版联机帮助。