سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top