mechatroner / RBQL

🦜RBQL - Rainbow Query Language: SQL-like query engine for (not only) CSV file processing. Supports SQL queries with Python and JavaScript expressions.
https://rbql.org
MIT License
276 stars 13 forks source link

Add Having clause #19

Open fdncred opened 4 years ago

fdncred commented 4 years ago

Sometimes I need the ability to find duplicates in a CSV file. RBQL would be great for this if it supported the having clause.

Here's my example usage. select a2, count(*) group by a2 where NR > 1 having count(*) > 1

BTW - RBQL is a great helper. Thanks for it! I forgot to mention that I'm using Rainbow CSV in vscode.

mechatroner commented 4 years ago

Thanks for the feedback! And thank you for the proposal, I guess it would be possible to implement HAVING, but I haven't look deep into this yet. BTW you can emulate HAVING with two consecutive queries: first GROUP BY, and then WHERE on the result set of GROUP BY, although this is not an elegant solution.

fdncred commented 4 years ago

Thanks @mechatroner for the tip. Would you mind showing me an example of how to have two consecutive queries like you're suggesting?

fdncred commented 4 years ago

oh, wait. You may mean just get the results of the first query and then run another query on those results. I thought you were saying to do it with one rbql statement.