Home > database >  Oracle switched line column
Oracle switched line column

Time:09-21

Select * from (select c. name, f_Get_Age (c. date of birth) as the age, decode (c. gender, '1', 'male', '2', 'woman') as gender, c. id number, e. name of problem, b. end time as discharge date, j. name, a. checkout amount
The from record a personal cost, service activities record b, c, personal information list income subject j, personal questions e
Where a. Personal id=b. personal id

And a. event id=b.i d

And b. the='individual hospital records'
And a. personal id=c.i d
And a. income course id=j.i d
And e. personal id=a. personal id
And e. service record id=b.i d
And e. problem names like '% % ('
And b. end time between to_date (' 2015-01-01 00:00:00 ', '- dd yyyy - mm hh24: mi: ss') and to_date (' 2018-01-01 00:00:00 ', '- dd yyyy - mm hh24: mi: ss')) pivot (sum (a. checkout amount) for names in (select receipt fee item from income subject))

Why inside the sum "a. invoicing amount" no, but just write "invoicing amount", and behind this statement is always prompt expression in missing,

CodePudding user response:

Why sum inside 1. Write "a. invoicing amount" no, but just write "invoicing amount",
Answer: the pivot statistics is the result of the inner table of the set, a table is the inner table alias, pivot can only access closing value of this field,
Like:
Select
The from (select a. checkout amount from the table name a)
Where,,,

Can only be used where clause for the inner query processing of the result set closing value of this field, can't use a. Any field,

And behind this statement is always prompt expression in missing,
2. Intelligent use field or variable in behind, unable to use the select result sets, this is the requirement of grammar
  • Related