本文介绍了sql查询集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有2个表:
puzz_meeting_candidats :
- id, canceled, candidat_id, meeting_id
puzz_meeting :
- id, Client
我有一个查询:
SELECT U1.`candidat_id` AS Col1 FROM `puzz_meeting_candidats` U1
INNER JOIN `puzz_meeting` U2 ON ( U1.`meeting_id` = U2.`id` )
WHERE U2.`Client` LIKE '%ipsos%' AND U1.`canceled` = False
如何将查询转换成queryset
How to convert query above to queryset
推荐答案
Puzz_Meeting_Candidats.objects.filter(cancelled = False ,meeting__Client__contains ='ipsos')
Puzz_Meeting_Candidats.objects.filter(canceled=False, meeting__Client__contains='ipsos')
这篇关于sql查询集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!