webForumDet fria alternativet
Logga in / Bli medlem

avancerad ORDER BY ?

Databaser & SQL

2 svar · 226 visningar · startad av Gein

Medlem sedan sep. 20005 700 inlägg
Frågan#1

går det att köra en ORDER BY (summa2 - summa1) på något sätt? alltså subtrahering(stava?) :D

Medlem sedan dec. 1999707 inlägg
#2

Uhm, nej det går nog inte. Vet nog inte riktigt vad du tänker på att du vill åtstadkomma men order by syftar på ett, eller flera fält.

------------------------------

ORDER BY

Syntax
[ ORDER BY { order_by_expression [ ASC | DESC ] } [ ,...n] ]

Arguments
order_by_expression

Specifies a column on which to sort. A sort column can be specified as a name or column alias (which can be qualified by the table or view name), an expression, or a nonnegative integer representing the position of the name, alias, or expression in select list.

Multiple sort columns can be specified. The sequence of the sort columns in the ORDER BY clause defines the organization of the sorted result set.

The ORDER BY clause can include items not appearing in the select list. However, if SELECT DISTINCT is specified, or if the SELECT statement contains a UNION operator, the sort columns must appear in the select list.

Furthermore, when the SELECT statement includes a UNION operator, the column names or column aliases must be those specified in the first select list.

Medlem sedan dec. 19998 577 inlägg
#3

puzze, har du testat innan du frågar... ;)

255 ms totalt · 4 externa anrop · v20260731065814-full.1b2494f0
124 ms — deklarationer (db)
0 ms — hämta statistik (cache)
128 ms — hämta tråd, inlägg och bilagor (db)
125 ms — ändringar (db)