mercredi 24 juin 2015

Count(*) Over() equivalent in Sqlite

Is there way to achieve the Count(*) Over() equivalent in sqlite. Below is the sql query.

select col1, col2, count(*) over() as somecount from tb1 where tb1.id=@id 

I wrote the following query in sqlite which works. Is this the correct approach or is there any better alternative ?

select col1, col2, (select count(*) from tb1 where tb1.id=@id) as somecount from tb1 where tb1.id=@id 

Aucun commentaire:

Enregistrer un commentaire