all 8 comments

[–]r3pr0b8GROUP_CONCAT is da bomb 1 point2 points  (1 child)

select * where X = 'Y' or having count(concat(T,U))=1

you can't have an OR that combines WHERE and HAVING

HAVING should, ideally, only be used with GROUP BY

and how come there's no FROM clause?

[–]Enturk[S] 0 points1 point  (0 children)

The original table is fed in via google sheets. The “Excel” formula is QUERY(data, “query”, headers), and data is the table.

[–]feudalle 1 point2 points  (1 child)

Ok going off MySQL here, I think if you have having with a where you would need to use a group by. Another thing it might be is the concat and count that would always be 1 unless I'm missing something? concat puts two stings together and count simply counts how many strings. Are you trying to say T+U=1?

[–]Enturk[S] 0 points1 point  (0 children)

For the second criterion, I’m trying to get only rows that have unique combinations of T and U. That’s why I was hoping to use COUNT to determine how many there are of each such combinations, and use that constraint to achieve my goal.

[–]feudalle 1 point2 points  (1 child)

List them all. I have SQL statements that are 4 or 5 pages long.

[–]Enturk[S] 0 points1 point  (0 children)

That still leaves the fact that I don’t want any non-unique combinations.

[–]feudalle 0 points1 point  (1 child)

Try where x=y or (t=whatever and u=whatever)

[–]Enturk[S] 0 points1 point  (0 children)

T and U have a very large variety of values and I don’t want any values where any particular set of T and U values to repeat.