【问题标题】:Django ORM SQL Raw MysqlDjango ORM SQL 原始 Mysql
【发布时间】:2021-08-26 06:03:21
【问题描述】:

选择 CONCAT(first_name,last_name) 作为 broker_name,coupon_name, (select count(user_details.id) from user_details join user on user.id=user_details.user_id and user.role_id=3 where refer_coupon_id=coupons.id) 作为tenat_referrals, (select count(user_details.id) from user_details join user on user.id=user_details.user_id and user.role_id=2 where refer_coupon_id=coupons.id) as landloard_referrals 来自用户 LEFT JOIN 优惠券上的 coupons.user_id=user.id where role_id=4

【问题讨论】:

  • 问题是什么?

标签: python django orm


【解决方案1】:

我们想帮助您。您能否更清楚地说明您的问题是什么,以便我们为您提供帮助?

我希望你的问题已经解决了!

对不起我的英语水平。

【讨论】:

  • 我想把上面的查询转换成 Django ORM 格式
猜你喜欢
  • 2020-10-21
  • 2019-08-05
  • 2010-11-12
  • 2019-04-03
  • 2018-05-15
  • 2022-08-18
  • 2019-06-11
  • 2014-10-31
  • 2017-09-26
相关资源
最近更新 更多