You can use column numbers to indicate sort columns in the ORDER BY clause. This is especially helpful when sorting on calculated columns. Eg: Select account, ((curyear – prevyear) * 0.5) from saleshist order by 2, 1
Author: nanda1980
Common table Expression(CTE)
Common table expressions (CTEs) allow you to break down complex SQL logic into smaller pieces.Common table expressions (CTEs) are simply defined using the WITH keyword. They allow for logic to be coded in a single place and simplify coding and maintainability. CTE is like a temporary view. CTE Syntax: A CTE must be part of a SELECT statement. […]