I want to convert this query:

 SELECT
    c.id,
    c.buy_long,
    c.stop_sell,
    c.sell_short,
    c.stop_buy,
    c.the_date,
    p.symbol,
    s.open_price,
    s.high_price,
    s.low_price,
    s.close_price
    FROM
    csbuysell c,
    onepair p,
    dailystats s
    WHERE
    c.one_pair_id = p.id AND
    s.one_pair_id = c.one_pair_id AND
    s.the_date = c.the_date
    order by the_date desc

I can't seem to do it without custom sql, that breaks pagination to
use raw.

There is no FK relationship between dailystats and csbuysell, hence
the need to do a where join. I figured that out, using
extra(where=['s.one_pair_id = c.one_pair_id. AND s.the_date =
c.the_date'], but
1. how to add the from clause and then the fields in the query?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to