"having" statement in aggregate functions
I'm doing a group by to aggregate a table and get a count of record. I'd like to only get the rows where the count = 1. In SQL, this would be something like:
select name, count(1)
from table
group by name
having count(1) = 1.
Is this possible using the query all record function? I don't see it in the output tab.
Best Answer
-
It's not part of the query all records, but you could apply that filter pretty straightforwardly in the function stack following the query. I would use the array function, "find every element" and set up criteria to apply the "having" logic you've articulated above.
Under the covers Xano uses a Postgresql database so this functionality is just a step away, but they don't seem to surface it directly yet - so we use workarounds like the above.We often work on data manipulation challenges as part of our focus on the hardest 5% of challenges in our daily office hours and loom-enabled help discussions at Statechange.ai.
Answers
-
Thanks, Ray! Your suggestion is essentially what I did, was just hoping for something more efficient.
-
Hey Michael, great suggestion. I've added this to our feature request board here; please give it an upvote if you have time!
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback