On Sun, Oct 18, 2009 at 11:49 AM, Igor Tandetnik <[email protected]> wrote:
> P Kishor wrote:
>> Given a specific user_id (say, user_id = 1) how on earth do I get the 
>> following?
>> idea_id     idea         created_by_name  rating
>> ----------  -----------  ---------------  ----------
>> 1           free coffee  jim              100
>> 2           long breaks  jim              100
>> 3           quit early   joe              NULL
>
> Describe in plain English precisely what you are trying to achieve. It's not 
> obvious to me what question this resultset is the answer for.
>


Given a specific user, show me all the ideas, and, if the specific
user has voted for an idea, show me the rating given to that idea by
that user.

So, in the above result set, all three ideas are shown, and Jim's
ratings are shown. Since Jim didn't rate idea 3, 'NULL' is returned.


Since I couldn't figure out a SQL for the above, for now, I am pulling
all the ideas, then pulling all the ratings that belong to "Jim", then
re-upping the ideas result set with Jim's ratings in a Perl sub.

-- 
Puneet Kishor
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to