Hi,
class BasicDetails(models.Model):
age = models.PositiveSmallIntegerField(null=False, blank=False)
dom = models.PositiveSmallIntegerField(null=False, blank=False)
dod = models.PositiveSmallIntegerField(null=False, blank=False)
doy = models.PositiveIntegerField(null=False, blank=False)
gender = models.CharField(max_length=1)
Below I have provided the queries with results which I executed from
mysql prompt.
I am not able to figure out the django queries for these sql queries.
Could some one please guide me on resolving the below mysql queries in
django.
mysql> select * from polls_basicdetails;
Django---> polls_basicdetails.objects.all()
+----+-----+-----+-----+------+--------+
| id | age | dom | dod | doy | gender |
+----+-----+-----+-----+------+--------+
| 1 | 18 | 1 | 1 | 1991 | M |
| 2 | 19 | 1 | 1 | 1991 | M |
| 3 | 20 | 1 | 1 | 1991 | M |
| 4 | 18 | 1 | 1 | 1991 | M |
+----+-----+-----+-----+------+--------+
mysql> select distinct age from polls_basicdetail
Django ----> ?????????????
+-----+
| age |
+-----+
| 18 |
| 19 |
| 20 |
+-----+
mysql> select age, dom from polls_basicdetails;
Django ----> ?????????????
+-----+-----+
| age | dom |
+-----+-----+
| 18 | 1 |
| 19 | 1 |
| 20 | 1 |
| 18 | 1 |
+-----+-----+
Thanks for your time.
Regards,
Lokesh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---