Altering the views Sorting Criteria, to display first ISSET fields Ia am working on a view that displays search results for nodes of a certain content type. In this Content Type there is a field "photo". Some of the nodes have a photo, some of them not. Is it possible to display (in the search results), first the nodes that have that field filled and at the bottom the nodes where the field photo is not set? 

I tried to achieve it with custom sorting in the PHP field, using a snippet that i found here : https://drupal.org/node/727418#comment-3827246

$query-&gt;orderby = "CASE WHEN myFieldName IS NULL THEN 0 END, myFieldName ASC"; }


but it didn't work. Any ideas?
Why not order by quantity of elements in photo field, or delta ?