私はテーブルpartywise_account_ledger
とカラムname_of_the_customer
,invoice_date
およびinvoice_value
を持っています。私は、日数に応じてinvoice_value
を検索したいと思います。私は、クエリを使用< 5 days
の値を取得するには:カラムを取得する方法SQLの2つの日付の間の日数を持つレコード
select name_of_the_customer, sum(invoice_value)
from partywise_accounts_ledger
where datediff(d, invoice_date, '2017-04-19') < 5
group by name_of_the_customer
This is the Result of the Query
をどのように私はそれに追加< 10 days
列を取得し、単一のステートメントで表示することができますか?
ありがとうございます!
いくつかのサンプルテーブルデータと期待される結果、および書式付きテキストを追加します。 – jarlh
http://meta.stackoverflow.com/questions/333952/why-should-i-provide-an-mcve-for-what-seems-to-me-to-be-a-very-simple-sql-クエリ – Strawberry