Dear Anthony, I have asked the question on Stackoverflow and it seems it is a bad database structure ;) Sorry.
See : http://stackoverflow.com/questions/7908024/sql-query-list-fields I will put the status information somewhere else. Maybe in a separate database. I don't know yet. Thanks for the help you gave me, Archibald On 26 oct, 20:35, Archibald Linx <archibaldl...@gmail.com> wrote: > Thank you Anthony. > > I don't know about the raw SQL query. I will ask on Stackoverflow and > post the link here. > > Best, > Archibald > > On 26 oct, 19:07, Anthony <abasta...@gmail.com> wrote: > > > > > > > > > On Wednesday, October 26, 2011 12:21:33 PM UTC-4, Archibald Linx wrote: > > > > Thank you Anthony ! > > > > Is the length "len" always defined in Python ? > > > No, I think the len() function will fail if you pass None to it, so if you > > were using request.vars, you'd want something like: > > > default=len(request.vars.to) if request.vars.to is not None else [whatever > > you want the default to be otherwise] > > > > I couldn't find much tools in the documentation to query lists of > > > references apart from the "contains" operator. > > > > For example, let's have the following "message" table : > > > id / to / status > > > 1 / steve,jimmy / 0,2 > > > 2 / john,julia / 1,2 > > > 3 / julia,peggy / 0,1 > > > > I want to get the rows where "Julia" is in "to" and where her status > > > is "0" (in this particular case, that is row n°3). > > > With the "contains" operator I only know how to get the rows where > > > "Julia" is in "to" (that is row n°2 and n°3). > > > > Should I write raw SQL ? > > > How would you write it in raw SQL?