how do I code sql using the raw method?

7 views
Skip to first unread message

frocco

unread,
Jan 23, 2013, 9:13:46 AM1/23/13
to django...@googlegroups.com
Hello,

I need to code a select statement based on a dynamic field.

select price_a as price from table

def return priceLevel(x):
if x == 'A': return 'price_a'
if x == 'B': return 'price_b'
if x == 'C': return 'price_c'

so my sql would be:

fld = priceLevel('B')
select fld as price from table

I cannot get the select statement to work.
Thanks

frocco

unread,
Jan 23, 2013, 9:47:49 AM1/23/13
to django...@googlegroups.com
Nevermind, I got this working.
Reply all
Reply to author
Forward
0 new messages