Basic SQL query issue

Hello,

Can someone tell me why when I execute this query
SELECT unt_name, unt_isDefault, uct_type FROM param_unit, unit_category WHERE param_unit.fk_uct = unit_category.uct_id and unit_category.uct_type in ("date", "duration", "weight") ORDER BY unt_name ASC;

I have this
sqlquery

and if I add a condition to the WHERE clause (uct_type = “true”)
SELECT unt_name, unt_isDefault, uct_type FROM param_unit, unit_category WHERE param_unit.fk_uct = unit_category.uct_id and unit_category.uct_type in ("date", "duration", "weight") and unit_category.uct_type = "true" ORDER BY unt_name ASC;

I get nothing ?
:confused:

Thanks

Exist This Value “true” in This field (unit_category.uct_type ) ?
The logical operator “and” requires that all checks are true.

SELECT unt_name, unt_isDefault, uct_type FROM param_unit, unit_category WHERE param_unit.fk_uct = unit_category.uct_id and unit_category.uct_type in (“date”, “duration”, “weight”) and unit_category.uct_type = “true” ORDER BY unt_name ASC;
If only one of the expressions is false, the “and” will return false ( nothing will be returned).

1 Like

Ok, my mistake ! It was too late yesterday. Actually I was spotting the wrong field, unit_category.uct_type instead of param_unit.unt_isDefault ! :sleeping:

Thanks @Rogerio_Rios

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.