Django获取列中具有相同值的所有行

时间:2021-03-28 07:56:56

how can I filter in Django to get a data row one times if the same value in on column?

如果列中的值相同,我如何在Django中过滤以获取一次数据行?

columns: 
a | b
x | y
a | y
y | s

Want one data row set with y (b) and one data row set with s (b).

想要使用y(b)设置一个数据行,使用s(b)设置一个数据行。

If not clear what I mean I edit with SQL script... EDIT: SELECT DISTINCT b FROM table;

如果不清楚我的意思我用SQL脚本编辑...编辑:SELECT DISTINCT b FROM table;

1 个解决方案

#1


1  

Sorry to be blind... http://docs.djangoproject.com/en/dev/ref/models/querysets/

抱歉是失明的... http://docs.djangoproject.com/en/dev/ref/models/querysets/

Have a nice day.

祝你今天愉快。

#1


1  

Sorry to be blind... http://docs.djangoproject.com/en/dev/ref/models/querysets/

抱歉是失明的... http://docs.djangoproject.com/en/dev/ref/models/querysets/

Have a nice day.

祝你今天愉快。