C
C
Cyril2014-05-29 14:06:07
SQL
Cyril, 2014-05-29 14:06:07

Is it possible to create sql query and get 2 queryset?

A question for self-development, let's say I have posts and I must first display all posts with the True flag on the page and then all the posts with the False flag. Now I do it like this:
1) I get all posts from the database
2) a loop going through all posts and displaying only posts with the True flag
3) a loop through all posts outputting with the False flag
Is it possible to immediately get 2 querysets with different flags via SQL query so as not to drive cycles, in general, in some subds, orm?
Well, can someone tell me how to do it right, I have a project on Django + PostreSQL

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
1001001 111, 2014-05-29
@aeHarkonnen

ORDER BY flag

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question