Like this? ( database: mysql )-->
    ...
    q = request.REQUEST['q']
    ...
    from django.db import connection
    cursor = connection.cursor()
    cursor.execute("SELECT * FROM table_1, table_2, table_3 WHERE
part_number = %s", [q])
    resultset = cursor.fetchone()

    But it doesn't work:

Exception Type: OperationalError
Exception Value: (1052, "Column 'part_number' in where clause is
ambiguous")

    and also the resultset is not a queryset, it's a tuple list?

[ ( ... ), ( ... ), ( ... ) ]



> Write a raw SQL query. If you want to perform optimisation like this at
> the database level (rather than looping over each model type and
> queyring individually), you are encouraged just to query the database
> directly.
>
> It will then be fairly straightforward to split up the results and
> create model instances out of each them.
>
> Cheers,
> Malcolm
>
> --
> The sooner you fall behind, the more time you'll have to catch 
> up.http://www.pointy-stick.com/blog/- 隐藏被引用文字 -
>
> - 显示引用的文字 -


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to