Reputation: 1839
I have the following query for a measurement:
select foo from myMeasurement
which returns something like this:
time foo
---- ----
123412341234123412 valOne
123412341234123413 valOne
123412341234123414 valOne
123412341234123415 valTwo
123412341234123416 valTwo
123412341234123417 valThree
123412341234123418 valThree
123412341234123419 valThree
123412341234123420 valThree
I would like to get the count of each one. In other words I would like to get the following
foo numResults
--- ----------
valOne 3
valTwo 2
valThree 4
I have tried using select count(*) and group by foo, but I can't seem to get the correct syntax/combination to generate the desired results.
Any help would be appreciated, thanks!
Upvotes: 0
Views: 81
Reputation: 420
Is the foo
field marked as a tag? The GROUP BY
sentence doesn't work in any kind of field. It's not like in a relational database where you can easily GROUP BY
by any field.
In this case the foo
field should be marked as a tag field.
You can check the following documentation: GROUP BY tags
A little bit above you can see the following description:
Note: You cannot use GROUP BY to group fields.
Once you have it you can execute the same query and it will work.
Upvotes: 1