have查询:“SELECT date,COUNT(id)FROM leads WHERE userkey='$userkey'GROUP BY DAY(date)”
我要加上第二条,第一条是
例子:
[第一]
SELECT date, COUNT(id) FROM leads WHERE userkey = '$userkey' GROUP BY DAY(date)
[秒]
SELECT COUNT(price) from leads WHERE userkey = '$userkey' and is_lead = 1
工会不工作。
请帮忙!

最佳答案

或者你想这么做?

SELECT a.userkey,DATE, COUNT(id),b.countp
  FROM leads a
  LEFT JOIN (SELECT COUNT(price) AS countp
        FROM leads
        WHERE userkey = '$userkey' AND is_lead = 1) b
    ON a.userkey=b.userkey
WHERE userkey = '$userkey'
GROUP BY DAY(DATE)

07-27 14:00