Re: Concatenate fields

2007-05-30 Thread Tim Chase

> I have a question about filtering queries concatenating fields.
> I just saw in documentation the possibility to concatenate (AND, OR)
> sentences, but not concatenate table-fields to filter something. Is
> the Django DB-API able to do something like that?
> 
> [SQL]
> WHERE lower(table1.label || ' ' || table2.label) LIKE '%something%'

Sounds like you're looking for the extra() call:

http://www.djangoproject.com/documentation/db-api/#extra-select-none-where-none-params-none-tables-none

where you can create your own WHERE clauses.

-tim





--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Concatenate fields

2007-05-30 Thread Gabriel Laet

Hi,

I have a question about filtering queries concatenating fields.
I just saw in documentation the possibility to concatenate (AND, OR)
sentences, but not concatenate table-fields to filter something. Is
the Django DB-API able to do something like that?

[SQL]
WHERE lower(table1.label || ' ' || table2.label) LIKE '%something%'


Thanks in advance. Cheers!


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---