specefic field(s) for each query.

14 views
Skip to first unread message

Mohsen Pahlevanzadeh

unread,
Jan 11, 2020, 12:38:44 PM1/11/20
to Django users
Hello everybody,

I can write django code for "select * from mytables;", but I can't specefic fields such as "select field(s) from my table;"

Please help me......
Message has been deleted

山村維宏

unread,
Jan 11, 2020, 12:42:40 PM1/11/20
to django...@googlegroups.com
use values().

example:
Foo.objects.filter(name='foo').values('bar', 'baz')

2020年1月12日(日) 2:38 Mohsen Pahlevanzadeh <m.pahle...@gmail.com>:
Hello everybody,

I can write django code for "select * from mytables;", but I can't specefic fields such as "select field(s) from my table;"

Please help me......

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8ecebac0-f389-41ce-b5b2-a271e3412832%40googlegroups.com.

Santhosh sridhar

unread,
Jan 11, 2020, 12:44:45 PM1/11/20
to Django users
You can query like this in Django, say A is the table name and B is the columns. A.objects.all().values('B') or A.objects.all().values_list('B',flat=True)

Regards,
San

ACG

unread,
Jan 12, 2020, 8:10:14 AM1/12/20
to Django users
Hi, first you may connect, is expect than you did it. Them Ex : Select name from sysobjects where type='U' 

Apologize my english, i am learning....


Reply all
Reply to author
Forward
0 new messages