Android Question SQLite "OVER PARTTION" not supported in B4A ?!

Status
Not open for further replies.

Kanne

Member
Licensed User
Longtime User
Hi,
I wanted to add some statistics to my App and now have the problem, that it seems that "OVER" is not supported by B4A ?!

B4X:
SELECT Spieler, count(*) OVER (PARTITION BY spieler ORDER BY Spieler_Spieltag.ID_Spieltag) as Part_SUM
from  Spieler_Spieltag

Executing the statement in "DB Browser for SQLite" works fine, but in B4A I get an error:


or

 

Attachments

  • 2020-04-14_103227.jpg
    130.4 KB · Views: 324

OliverA

Expert
Licensed User
Longtime User
Upvote 0

aeric

Expert
Licensed User
Longtime User
My query is group by Spieler. So the same Spieler would have same value. Not sure how you want to get the Punkte_Summe. If let say you want the Punkte_Summe = SUM by the Datum, then inside the subquery B you can GROUP by Datum.

SQL:
GROUP By SS.Datum  -- Line #17

SQL:
WHERE A.Datum = B.Datum -- Line #20

SQL:
(SELECT SS.Datum,  -- Line #8

 
Last edited:
Upvote 0

Kanne

Member
Licensed User
Longtime User
I know what a "grouped by" does. Even grouping by detailed fields does make a running subtotal ! I will now stop discussing that in this thread.
 
Upvote 0

pcicom

Member
Licensed User
Longtime User

B4X:
SELECT Spieler,Spieldtag, count(*)  as Part_SUM
from  Spieler_Spieltag GROUP BY 1,2 

or  OPCIONAL ORDER

SELECT Spieler,Spieldtag, count(*)  as Part_SUM
from  Spieler_Spieltag GROUP BY 1,2 ORDER BY 1,2

1 = Field Spieler :       1 is a position field on query select
2 = Field Speldtag  :  2 is a position field on query select


[/QUOTE]
 
Upvote 0

Kanne

Member
Licensed User
Longtime User
please read the complete thread:
the sqlite-windows-function are available from version 3.25 - so you need a very actual Android on your device, on older versons you get a sql-error (like me - that was the reasdon for this thread)
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
It works with the latest SQLCipher version, 3.25.2.

RBS

To prove it works try these 3 statements:

create table t0(x integer primary key, y text)

insert into t0 values(1, 'aaa'), (2, 'ccc'), (3, 'bbb')

select x, y, row_number() over (order by y) as row_number from t0 order by y

RBS
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The question was:
"SQLite "OVER PARTTION" not supported in B4A ?!"

The answer is:
1. No such thing as "not supported in B4A". It is the internal native SQLite engine that does all the work.
2. This feature was added in SQLite v3.25

Now go here: https://developer.android.com/reference/android/database/sqlite/package-summary
You will see that the latest documented version in Android is 3.19.

There was also a remark about the unneeded usage of ?!.

For any other discussion please start a new thread.
 
Upvote 0
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…