sqlite3 test.db
create table data(num1 float,num2 float);
insert into data values(1.2,3.4);
insert into data values(4,0);
insert into data values(2,5);
insert into data values(3,0);
insert into data values(5.2,3);
sqlite> select num1/num2 from data order by num1/num2 asc;
0.352941176470588
0.4
1.73333333333333
输出中有五行,两行空行,如何省略结果中的数字/ 0,我只想要三行作为结果
答案 0 :(得分:0)
要从结果中过滤掉记录,请使用WHERE子句:
SELECT num1 / num2
FROM data
WHERE num2 <> 0
ORDER BY 1