Hi all,

i have a complex query and want to do this query with the django orm.
I already use django, but the raw-sql-way:

def get_windenergy_data(self, windspeed_channel,
winddirection_channel, project_id, logger_serial):
        from django.db import connection
        cursor = connection.cursor()
        cursor.execute(""" select S.value, D.value from
measurements_data as S
                        left join measurements_data as D
                        on S.datetime=D.datetime
                        where S.channel=%(windspeed_channel)s and
D.channel=%(winddirection_channel)s and
                        S.project_id=%(project_id)s and D.project_id=%
(project_id)s and
                        S.logger_serial=%(logger_serial)s and
D.logger_serial=%(logger_serial)s
                        ;""",  locals() )
        row = cursor.fetchall()
        cursor.close()
        return row


Can anybody help?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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