Home > database >  The small white based problem solving
The small white based problem solving

Time:12-04

Statement:
Id, NAME, select a. a. GUID project, project NAME, date of death, Max (substring (payment time, 1, 8)) as the final payment date, sum (cast (payment amount as float)) as involving
The from issuing subsidiary as a
Id=join death list as b on a. b. citizen id card number
Where project GUID (8, 1017101, 8120, 7140) and in the substring (payment time, 1, 6) & gt; The substring (date of payment, 1, 6)
NAME, group by a. a. id, GUID project, project NAME, date of death order by project GUID;
Question 1: why is the first line is "a." NAME, but the project's GUID, project NAME here but there was no "a.";
Question 2: guess the statement execution order is in accordance with the first "a. id=b. citizen id card number" filter, and then in accordance with the "project GUID (8, 1017101, 8120, 7140) and in the substring (payment time, 1, 6) & gt; Substring (date of payment, 1, 6) "screening again, finally performing group by and order by statement,

CodePudding user response:

1. Should be a table name, this is a table with another list (death), there should be choose the detailed information of the dead, the a. id=b. citizen id card number, where the back of the screening process conditions;
2. The group by clause must appear after the where clause, before the order by clause,
  • Related