CodePudding user response:
Well, I like myself to solve, put the group behind, there is a problem, can add a select statement in front of this statement would be consistent with bh tuning out of use
CodePudding user response:
After the select column, if not aggregate column, must be in the group by list,
CodePudding user response:
Group by 1, is the time to appear in the content aggregation, there is no sum, count, such as polymerization without group by
2, want to reference check after bh, nested layer again
CodePudding user response:
And when the shop have a balance in 100 yuan of the following members, counting the shop every day will enhance the number of these below 100 yuan membership number (KHS1) and amount (JE1)
This means the balance in 100, under the statistical number?
CodePudding user response:
reference 4 floor js14982 response: and when the shop have a balance in 100 yuan of the following members, counting the shop every day will enhance the number of these below 100 yuan membership number (KHS1) and amount (JE1) This means the balance in 100, under the statistical number? Is not the balance is less than 100 members of the shop ascension membership count every day, like A shop has eight 100 yuan of the following members, tomorrow, there are two member charge less than 100 RMB, ascending number is 2.,, CodePudding user response:
reference jdsnhan reply: 3/f 1, the group by is the time to appear in the content aggregation, no sum, count, such as polymerization without group by 2, refer to the query of bh, then layer nested Is to use the select (... ) where in (sekect . . . . ) So, put inside a layer of reference data? CodePudding user response:
select count (1), sum (je1 - je) (select je, lead (je) over (partition by KHS order by sj) je1 The from dz The where... ) Where je1 & gt; '100' and je & lt; '100' ; CodePudding user response:
The reference 7 floor js14982 response: select count (1), sum (je1 - je) (select je, lead (je) over (partition by KHS order by sj) je1 The from dz The where... ) Where je1 & gt; '100' and je & lt; '100' ; the inside of the parentheses yourself and go to the where the back of the condition, this is your amount is less than 100, and after the charge in the amount is more than 100, and then calculate the number of entries and top-up amount, CodePudding user response:
refer to the eighth floor js14982 response: Quote: refer to 7th floor js14982 response: select count (1), sum (je1 - je) (select je, lead (je) over (partition by KHS order by sj) je1 The from dz The where... ) Where je1 & gt; '100' and je & lt; '100' ; the inside of the parentheses yourself and go to the where the back of the condition, this is your amount is less than 100, and after the charge in the amount is more than 100, and then calculate the number of entries and top-up amount, First select all have no from is added at the back of the where CodePudding user response:
select count (1), sum (je1 - je) from (select je, lead (je) over (partition by KHS order by sj) je1 The from dz The where... ) t Where je1 & gt; '100' and je & lt; '100' ; CodePudding user response:
The references to the tenth floor js14982 response: select count (1), the sum (je1 - je) from (select je, lead (je) over (partition by KHS order by sj) je1 The from dz The where... ) t Where je1 & gt; '100' and je & lt; '100' ; There is a problem, such as the select idh, je, sj from dz where (... Judge conditions), select newidh from dz where (... Judgment conditions), it is the first select statement in the idh to control within the scope of the second select, that is to say, such as the second select five values of output, first select the idh must output in this 5, how to write the nested, two I will write a select statement, reading a book in the where idh in I don't why CodePudding user response:
The select idh, je, sj from dz where idh in (select idh from dz where... ) CodePudding user response:
The refer to 12 floor js14982 reply: select idh, je, sj from dz where idh in (select idh from dz where... ) Where the first select the where statement CodePudding user response:
Behind the where ah, you're not going to the where idh in (select idh from dz where... ) and sj> '... '... CodePudding user response:
On the 14th floor js14982 reference response: where behind ah, you're not going to the where idh in (select idh from dz where... ) and sj> '... '... Oh? I try, thank you CodePudding user response:
On the 14th floor js14982 reference response: where behind ah, you're not going to the where idh in (select idh from dz where... ) and sj> '... '... And bother you, how to in the idh (name) for line, sj (time) under the column for idh XKS (new) 0 and xkje amount (new) to count, and XKS xkje in the table