sql - Esqueleto count inside select -


i have following entities:

group   name text  groupuser   user userid   group groupid 

and query this:

select g.* /* g */      , count(gu.id) groupuserscount    group g   left outer join groupuser gu on gu.groupid = g.id group g.id 

can done esqueleto?

the esqueleto docs groupby contain examples of how use it.

moreover, reading through getting started section, you'll see several example of queries including equivalent of table.*:

do people <- select $              $ \person ->              return person 

putting 2 means should work:

select $ \(g `leftouterjoin` gh) ->   on (gu ^. groupid ==. g ^. id)   groupby (g ^. id)   return (g, countrows) 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -