Question

I use next query:

SELECT ROUND(r/h) AS conv FROM table WHERE conv > 1

I receive error "Unknown column 'conv' in 'where clause'", But why? After AS conv is it not exists yet?

Était-ce utile?

La solution

The column alias isn't available until results are being produced. Try

SELECT ROUND(R / H) AS CONV
  FROM TABLE1
  WHERE ROUND(R / H) > 1

SQLFiddle here.

Share and enjoy.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top