我想表A登記的數量都在表B.確定的時間具體數額的MySQL從表中選擇其中條件x和子查詢
我要找的正確的方式做一些像此:
SELECT count(*) as total
from table_a as a
WHERE a.created >= '0000-00-00 00:00:00'
AND a.created <= (SELECT table_b.end WHERE table_b.id = 13)
基本上,表-B由3米欄:命名的「id」的int主鍵,一個名爲「開始」的日期時間,並命名爲「結束」的其他日期時間。這是我確定今年所有周的方式。
你錯過了從第二個選擇查詢條款... – ravikumar
謝謝!我沒有想到會接近解決方案! – Alberto