mauzer
03/23/2022, 11:10 AMthisOldDave
03/23/2022, 11:58 AMI don't exist
you have to use IS
or IS NOT
or the equivalent function
<CFQUERY NAME="application.argocond" DATASOURCE="newservinform">
Select ID_argo_cond, chiavi from tbl_argo_cond
where chiavi IS NOT NULL AND chiavi != ''
order by chiavi
</CFQUERY>
Adam Cameron
NULL
in your SQL statement, you don't need to parameterise it. Params are for when you have data to pass to the DB that need to be applied to the statement. In this case the statement seems to just be a literal string (ie: it is literally where chiavi <> NULL or chiavi <> ''
), so there aren't any params.websolete
03/23/2022, 1:15 PMWHERE chiavi IS NOT NULL AND chiavi <> ''
but it could be improved imo by using WHERE LEN( IFNULL(chiavi,'') ) > 0
(replace IFNULL with ISNULL depending on your db flavor)websolete
03/23/2022, 1:22 PMWHERE chiavi IS NOT NULL AND chiavi <> ''
depending on the number of rows in the tableDavid Buck
03/23/2022, 9:16 PMchiavi != ''
requires chiavi
to have a value (to compare to empty string), so it implicitly filters out rows where chiavi
has no value (i.e. is NULL). So the following should suffice:
SELECT ID_argo_cond, chiavi
FROM tbl_argo_cond
WHERE chiavi != ''
ORDER BY chiavi
That said, an argument could be made for including the NULL filter anyway for the sake of clarity.