0

I am trying to filter NULL results in my query but it is giving me an error.

My query:

SELECT
  cnt.id,
  cnt.title,
  cnt.introtext,
  cnt.fulltext,
  cnt.ordering,
  cnt.images,
  cnt.alias,
  cnt.state,
  f.item_id,
  MAX(CASE
    WHEN f.field_id = 3 THEN f.value
  END) AS inslider
FROM snm_fields_values f
JOIN snm_content cnt
  ON cnt.id = f.item_id
WHERE cnt.state = 1
AND f.value = 'ja'
AND inslider IS NOT NULL
GROUP BY f.item_id
ORDER BY f.item_id, inslider

This query gives me:

Unknown column 'inslider' in where clause.

inslider is the row that returns a null value, when I remove the IS NOT NULL line from the above query, my result is:

enter image description here

( I know an image is bad instead of text but I couldn't get it formatted nicely on SO. )

How can I filter a result if it returns NULL on inslider (which is an alias).

Laxmi
  • 3,830
  • 26
  • 30
twan
  • 2,450
  • 10
  • 32
  • 92

0 Answers0