Hi folks.  

I'm migrating to Sequel from using the PG gem, due to the async nature of 
some of their calls.  I was getting closure on the connections so I thought 
I'd ride this train.

I have some dashboard charts that require SQL statement like the 
following.  Is it recommended that I use straight SQL for these, or can 
Sequel handle them?

res = DBN.fetch( %Q{ SELECT a."TheDate", COALESCE(b."recs", 0) mycount
    FROM
    (
    SELECT CURRENT_DATE - i "TheDate"
      FROM generate_series(0, 29) i
    ) a
    LEFT OUTER JOIN (
      SELECT ts::date, COUNT(*) "recs"
        FROM ptree_admin
        WHERE ts::date > (CURRENT_DATE - INTERVAL '30 DAY')::DATE
        AND kind = 'search_done'
        GROUP BY ts::date
      )b ON a."TheDate"=b.ts::date
    } ).to_a

It's a bit of a doozie even for straight SQL.  Just wondering how advanced 
Sequel is.  I'm happy all the same as it provides DB.fetch.  

Cheers

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/eff37c1d-f1ff-4df7-aa04-4aaacbd70662%40googlegroups.com.

Reply via email to