Effective SQL: 61 Specific Ways to Write Better SQL (Effective Software Development Series) by Viescas John L. & Steele Douglas J. & Clothier Ben G

Effective SQL: 61 Specific Ways to Write Better SQL (Effective Software Development Series) by Viescas John L. & Steele Douglas J. & Clothier Ben G

Author:Viescas, John L. & Steele, Douglas J. & Clothier, Ben G. [Viescas, John L.]
Language: eng
Format: azw3
Publisher: Pearson Education
Published: 2017-01-09T05:00:00+00:00


SELECT ColumnA + ColumnB

FROM Table1 GROUP BY ColumnA, ColumnB;

SELECT ColumnA + ColumnB

FROM Table1 GROUP BY ColumnA + ColumnB;

SELECT ColumnA + ColumnB + constant

FROM Table1 GROUP BY ColumnA, ColumnB;

SELECT ColumnA + ColumnB + constant

FROM Table1 GROUP BY ColumnA + ColumnB;

SELECT ColumnA + constant + ColumnB

FROM Table1 GROUP BY ColumnA, ColumnB;

However, if the grouping is inconsistent with how the columns appear in the SELECT clause, the grouping is not allowed, as shown in Listing 5.3 on the next page.

Listing 5.3 Invalid GROUP BY clauses

Click here to view code image

SELECT ColumnA, ColumnB

FROM Table1 GROUP BY ColumnA + ColumnB;



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.