[sqlite] how can i omit the number/0 in the result in sqlite?

2014-04-19 Thread ????????
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.73  
 
There are two blank lines ,how can i omit the  number/0  in the result,i want 
only three lines as my result
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how can i omit the number/0 in the result in sqlite?

2014-04-19 Thread Richard Hipp
On Fri, Apr 18, 2014 at 10:35 PM, 水静流深 <1248283...@qq.com> wrote:

> 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.73
>
> There are two blank lines ,how can i omit the  number/0  in the result,i
> want only three lines as my result
>


  SELECT num1/num2 FROM data WHERE num2!=0 ORDER BY num1/num2 ASC;

Or:

  SELECT num1/num2 FROM data WHERE num1/num2 IS NOT NULL ORDER BY 1 ASC;

Or variations thereof.



> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how can i omit the number/0 in the result in sqlite?

2014-04-20 Thread Scott Robison
On Fri, Apr 18, 2014 at 8:35 PM, 水静流深 <1248283...@qq.com> wrote:

> 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.73
>
> There are two blank lines ,how can i omit the  number/0  in the result,i
> want only three lines as my result
>

SELECT NUM1/NUM2 FROM data WHERE NUM2 <> 0 ORDER BY NUM1/NUM2 ASC;

Off the top of my head, I think that should do it.

-- 
Scott Robison
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users