F FrankDev Active Member Licensed User Longtime User Mar 16, 2022 #1 hi, I have a sqlite problem have a table with the following values Field1, Field2 27256 , 1 27256 , 1 27256 , 1 27256 , 2 27256 , 2 28767, 1 28767, 1 28767, 2 32345, 1 32345, 1 I want to have the number of records when I group by field1 and field2 27256 , 1 27256 , 2 28767, 1 28767, 2 32345, 1 this is how it would be grouped without repetition so i want to have the result '5 Select ? group by field1, field2 regards Frank
hi, I have a sqlite problem have a table with the following values Field1, Field2 27256 , 1 27256 , 1 27256 , 1 27256 , 2 27256 , 2 28767, 1 28767, 1 28767, 2 32345, 1 32345, 1 I want to have the number of records when I group by field1 and field2 27256 , 1 27256 , 2 28767, 1 28767, 2 32345, 1 this is how it would be grouped without repetition so i want to have the result '5 Select ? group by field1, field2 regards Frank
R RB Smissaert Well-Known Member Licensed User Longtime User Mar 16, 2022 #2 FrankDev said: hi, I have a sqlite problem have a table with the following values Field1, Field2 27256 , 1 27256 , 1 27256 , 1 27256 , 2 27256 , 2 28767, 1 28767, 1 28767, 2 32345, 1 32345, 1 I want to have the number of records when I group by field1 and field2 27256 , 1 27256 , 2 28767, 1 28767, 2 32345, 1 this is how it would be grouped without repetition so i want to have the result '5 Select ? group by field1, field2 regards Frank Click to expand... I think FrankDev said: hi, I have a sqlite problem have a table with the following values Field1, Field2 27256 , 1 27256 , 1 27256 , 1 27256 , 2 27256 , 2 28767, 1 28767, 1 28767, 2 32345, 1 32345, 1 I want to have the number of records when I group by field1 and field2 27256 , 1 27256 , 2 28767, 1 28767, 2 32345, 1 this is how it would be grouped without repetition so i want to have the result '5 Select ? group by field1, field2 regards Frank Click to expand... select count(*) as cnt from (select distinct field1, field2 from table1) RBS Upvote 0
FrankDev said: hi, I have a sqlite problem have a table with the following values Field1, Field2 27256 , 1 27256 , 1 27256 , 1 27256 , 2 27256 , 2 28767, 1 28767, 1 28767, 2 32345, 1 32345, 1 I want to have the number of records when I group by field1 and field2 27256 , 1 27256 , 2 28767, 1 28767, 2 32345, 1 this is how it would be grouped without repetition so i want to have the result '5 Select ? group by field1, field2 regards Frank Click to expand... I think FrankDev said: hi, I have a sqlite problem have a table with the following values Field1, Field2 27256 , 1 27256 , 1 27256 , 1 27256 , 2 27256 , 2 28767, 1 28767, 1 28767, 2 32345, 1 32345, 1 I want to have the number of records when I group by field1 and field2 27256 , 1 27256 , 2 28767, 1 28767, 2 32345, 1 this is how it would be grouped without repetition so i want to have the result '5 Select ? group by field1, field2 regards Frank Click to expand... select count(*) as cnt from (select distinct field1, field2 from table1) RBS
mc73 Well-Known Member Licensed User Longtime User Mar 16, 2022 #3 B4X: select count(1) from (select field1,field2 from yourTable group by field1,field2) tblb B4X: select count(1) from (select distinct(field1||','||field2) from yourTable) tblb Try these out, not tested. Upvote 0
B4X: select count(1) from (select field1,field2 from yourTable group by field1,field2) tblb B4X: select count(1) from (select distinct(field1||','||field2) from yourTable) tblb Try these out, not tested.
F FrankDev Active Member Licensed User Longtime User Mar 16, 2022 #4 RB Smissaert said: I think select count(*) as cnt from (select distinct field1, field2 from table1) RBS Click to expand... hi, thank you very much, it works Upvote 0
RB Smissaert said: I think select count(*) as cnt from (select distinct field1, field2 from table1) RBS Click to expand... hi, thank you very much, it works
F FrankDev Active Member Licensed User Longtime User Mar 16, 2022 #5 mc73 said: B4X: select count(1) from (select field1,field2 from yourTable group by field1,field2) tblb B4X: select count(1) from (select distinct(field1||','||field2) from yourTable) tblb Try these out, not tested. Click to expand... hi, thank you very much. I have already tried the previous example. Works. what is the advantage of count(1) many greetings Upvote 0
mc73 said: B4X: select count(1) from (select field1,field2 from yourTable group by field1,field2) tblb B4X: select count(1) from (select distinct(field1||','||field2) from yourTable) tblb Try these out, not tested. Click to expand... hi, thank you very much. I have already tried the previous example. Works. what is the advantage of count(1) many greetings
mc73 Well-Known Member Licensed User Longtime User Mar 16, 2022 #6 FrankDev said: hi, thank you very much. I have already tried the previous example. Works. what is the advantage of count(1) many greetings Click to expand... To my knowledge, no advantage at all Upvote 0
FrankDev said: hi, thank you very much. I have already tried the previous example. Works. what is the advantage of count(1) many greetings Click to expand... To my knowledge, no advantage at all
F FrankDev Active Member Licensed User Longtime User Mar 16, 2022 #7 mc73 said: To my knowledge, no advantage at all Click to expand... ok... then I leave it as usual thanks again for the help. Stay healthy Upvote 0
mc73 said: To my knowledge, no advantage at all Click to expand... ok... then I leave it as usual thanks again for the help. Stay healthy