On Oct 27, 10:19 am, Jagdeep Singh Malhi <singh.malh...@gmail.com>
wrote:
> hi
> I want to use this mysql Query
> " SELECT count(*) as class_roll_no FROM student_profile where
> class_roll_no !='00 '  ";
> in my  view file
>
> Is it possible?
>
> I try this code
> view.py file is :
>
> from django.shortcuts import render_to_response
> from mysite.student.models import Profile
> from django.db.models import Count
>
> def fulldetail(request):
>     fulldetail = Profile.objects.all().order_by('class_roll_no')
>     total_count = Profile.objects.filter( class_roll_no !='00')
>     total = total_count.count()
>     return render_to_response("userprofile/profile/fulldetail.html",
> {"fulldetail" : fulldetail, "total":total} )
>
> Is this correct way to use this?
> if not please help or give any tutorials how to use mysql quires with
> some conditions.

http://docs.djangoproject.com/en/1.2/topics/db/queries/

BTW this question has nothing to do with MySQL.
--
DR.

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