InfluxDB merge different Field Value to single printout

Hello, Experts

i am the newcomer for the Influxdb
i want to get the one line printout by mix/merge different field value, like the following , (Mix or Merge is method what i assume)

select mix(value) from test group by “name”
name: test
tags: name=“case1”
time mix/merge

1970-01-01T00:00:00Z failed,passed,skipped

!!!

select * from test group by “name”
name: test
tags: name=“case1”
time caseAuthor caseName caseResult value

2018-07-20T03:51:42.599533888Z mike case1 pass 1
2018-07-20T03:51:42.690955475Z mike case1 failed 2
2018-07-20T03:51:42.723272883Z mike case1 skipped 3

thanks for any help
BRs
/Yijun

Hi @peter-zyj,

I’m not entirely sure what you’re asking or what you hope to accomplish. Are you trying to find all the unique values for a specific field? If that’s what you’re looking for, you can use the DISTINCT() function, which is documented here.

I have created an example which inserts 5 points, using the tags caseAuthor and caseName and the fields caseResult and value:

> insert test,caseAuthor="mike",caseName="case1" caseResult="pass",value=1
> insert test,caseAuthor="mike",caseName="case1" caseResult="failed",value=2
> insert test,caseAuthor="mike",caseName="case1" caseResult="skipped",value=3
> insert test,caseAuthor="mike",caseName="case2" caseResult="pass",value=1
> insert test,caseAuthor="mike",caseName="case2" caseResult="failed",value=2

Retrieving the data:

> select * from test
name: test
time                caseAuthor caseName caseResult value
----                ---------- -------- ---------- -----
1532128869943772100 "mike"     "case1"  pass       1
1532128900834008300 "mike"     "case1"  failed     2
1532128919880375300 "mike"     "case1"  skipped    3
1532128946957804900 "mike"     "case2"  pass       1
1532128965212745400 "mike"     "case2"  failed     2
> select * from test group by "caseName"
name: test
tags: caseName="case1"
time                caseAuthor caseResult value
----                ---------- ---------- -----
1532128869943772100 "mike"     pass       1
1532128900834008300 "mike"     failed     2
1532128919880375300 "mike"     skipped    3

name: test
tags: caseName="case2"
time                caseAuthor caseResult value
----                ---------- ---------- -----
1532128946957804900 "mike"     pass       1
1532128965212745400 "mike"     failed     2

You can then find the distinct field values as follows:

> select distinct("caseResult") from test
name: test
time distinct
---- --------
0    pass
0    failed
0    skipped
> select distinct("caseResult") from test group by "caseName"
name: test

tags: caseName="case1"
time distinct
---- --------
0    pass
0    failed
0    skipped

name: test
tags: caseName="case2"
time distinct
---- --------
0    pass
0    failed

If that’s not what you’re looking for you can find a complete list of the functions available in InfluxQL in our documentation.

thanks @noahcrowley

sorry for my poor description , my question is whether we have the function like " distinct ", but the function could combine/merge unique values(string var) to one line, or Merge 2 rows value to one, like:

your example:
> select MIX(“caseResult”) from test
name: test
time distinct
---- --------
0 pass
0 failed
0 skipped

My wish and request: MIX is guessed name what i like and want

> select distinct("caseResult") from test
name: test
time    MIX
---- --------
0    pass, failed, skipped

thanks
/Yijun

No, this is not currently possible.

Can you provide more details about what problem you hope to solve using this solution?

thanks Again @noahcrowley

what i want is base on the key of CaseName, list all existing Case Result by Grafana
like

for case1, so many round of test run on that, but all passed without failure
for case2, same round number of test, but 50% pass, 50% failure

i want to get the view, printout the query result, sort by key (case name), get the value(unique test result) in one line, which seems require the merge of different records’s value

thanks
/Yijun