Jump to content

looking to shorten a query by referencing a formula


slushpuppie

Recommended Posts

i have a query that is similar to this (only much more complex so i won't bother writing it out):

 

SELECT `one`, `two`, (`three` + `four`)

FROM `table`

WHERE (`three` + `four`) < 25

 

is there a way i can set (`three` + `four`) to something, so that i can only reference it like:

 

SELECT `one`, `two`, (`three` + `four`) AS `XXX`

FROM `table`

WHERE XXX < 25

 

(i know the above doesn't work, but i'm looking for something similar to it, where i can write out the equation once and then reference it).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.