Can I write this query using API criteria or am I stuck with HQL?
source link: https://www.codesd.com/item/can-i-write-this-query-using-api-criteria-or-am-i-stuck-with-hql.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Can I write this query using API criteria or am I stuck with HQL?
I have the following query which I would like to write using the criteria api of NH.
select status, count(1) from (select distinct Status, post_id from post_statistics) tbl group by status
each post_id can exist multiple times in post_statistics
id post_id status 1 1 open 1 1 edit 1 1 open 1 2 open
so the query should return the following results:
status count open 2 edit 1
thx in advance.
mappings, classes? if i'm thinking right, with a proper mapping this would effectively be something like
(pseudo-HQL)
select stat.Name, count(stat.Posts) from status stat
Related Articles
How do I write this query using the laravel query builder?
How to write this query using joins?
Can I modify this query using a WITH clause?
How can I write a query inside select in the rails
Rails Refactoring Block in Views - Can I Write This More Effectively?
How can I accelerate this query that joins a table on itself?
The most concise way to write this query to add a time to a date
How can I optimize this query?
How can I make this query SQL injection proof?
A better / more efficient way to write this query
How can I rewrite this query in Google BigQuery without the error exceeding
Positioning css with display or float, can I get this structure using the display property
How to write this query in the active records of codeigniter
How can I write this infix statement to postfix?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK