Untested, but should be near final:

ds = table.
filter(event_nbr: 12, event_date: Date.today).
select(
  :count.sql_function("*".lit).as(:row_cnt),
  :max.sql_function(:col1).as(:curr_timestamp),
  :max.sql_function(:col2).as(:entry_terminal),
  :max.sql_function(:col3).as(:entry_time))

Hope that helps!
François Beausoleil

Le 2012-12-07 à 17:31, Charles Monteiro a écrit :

> I"m trying to port the following to use Sequel , what follows is a stored 
> proc snippet:
> 
> SELECT COUNT ( * )
>                            , MAX ( col1 )
>                            , MAX ( col2 )
>                            , MAX ( col3 )
>                         INTO row_cnt
>                            , curr_timestamp
>                            , entry_terminal
>                            , entry_time
>                         FROM my_table
>                        WHERE event_nbr =
>                          row .event_nbr
>                          AND event_date =
>                          row .event_date;
> 
> 
> I can figure out how to break these up into separate statements but that 
> would mean more roundtrips to the db
> 
> I also know how to do plain multiple selects thanks to help on a previous 
> post, can't readily see if I can chain thing up as illustrated in the stored 
> proc snippet above.
> 
> thanks in advance,
> 
> -Charles
> 
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sequel-talk" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/sequel-talk/-/g9GHIc63yVcJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/sequel-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to