The following FullTextSQLQuery returns results:
SELECT PreferredName, Department, WorkEmail, HireDate
FROM SCOPE()
WHERE \"scope\" = 'People'
ORDER BY HireDate DESC
The following FullTextSQLQuery does not return any results:
SELECT PreferredName, Department, WorkEmail, HireDate
FROM SCOPE()
WHERE \"scope\" = 'People'
AND Department != ''
ORDER BY HireDate DESC
The only difference is the addition of "Department != ''" in the second query. I know there are records in which Department is blank. Why am I not getting any results for the second query?
UPDATE
When I query for text within the Department column, I don't get any results, even though there is text in the column:
SELECT PreferredName, Department, WorkEmail, HireDate
FROM SCOPE()
WHERE \"scope\" = 'People'
AND Department LIKE 'A%'
ORDER BY HireDate DESC
//no results!
If I do the same query on a different column, I get results:
SELECT PreferredName, Department, WorkEmail, HireDate
FROM SCOPE()
WHERE \"scope\" = 'People'
AND PreferredName LIKE 'A%'
ORDER BY HireDate DESC
//results!
Also if I do a People Search through the UI for Department:"name of department" (using an actual department name), I get results, so I know for sure that Department is being crawled. Does anyone have some insight on this?