Question

Viewing my result set, I see a blank field despite my conditions.

I tried selecting:

SELECT column
FROM table
WHERE LENGTH(column) > 0 AND column IS NOT NULL

i also tried:

WHERE LENGTH(column) <> 0 AND column IS NOT NULL

but, I'm still seeing a blank field.

In my SELECT, I tried checking the contents of the field:

SELECT column, LENGTH(column), HEX(column)

etc...

But, they both come up as 0 and seemingly empty, respectively.

What did I miss here?

Était-ce utile?

La solution

  SELECT 
      ....  
  FROM contacts as co 
  JOIN clients as cl 
    ON co.contact_client = cl.client_oldid 
  -- this starts a where clause
  WHERE cl.client_status = 2 
  -- ORDER BY ends a WHERE clause, and goes only for ordering:
  order by 
    cl.client_name  
    AND LENGTH(co.contact_email) > 0  -- so, order by result of this 0 or 1
    AND co.contact_email is not null  -- then, order by result of this 0 or 1
    AND TRIM(co.contact_EMAIL) <> '   -- then, order by result of this 0 or 1
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top