How to get the number of rows of the selected result from sqlite3?

前端 未结 8 474
情话喂你
情话喂你 2020-12-01 12:00

I want to get the number of selected rows as well as the selected data. At the present I have to use two sql statements:

one is

select * from XXX w         


        
相关标签:
8条回答
  • 2020-12-01 12:42

    try this way

    select (select count() from XXX) as count, * 
    from XXX;
    
    0 讨论(0)
  • 2020-12-01 12:44
    select (select COUNT(0) 
                from xxx t1 
                where t1.b <= t2.b 
                ) as 'Row Number', b from xxx t2 ORDER BY b; 
    

    just try this.

    0 讨论(0)
提交回复
热议问题