0

This is an extremely beginner-ish question, but... well, yes, I am a total beginner, and I just can't begin to find the answer on Google!

I wish to establish what percentage of contacts have received a face-to-face meeting during the year. So far, I have:

SELECT face_to_face/total FROM (
SELECT COUNT(DISTINCT contacts.id) AS total,
COUNT(DISTINCT contacts.id) AS face_to_face WHERE contacts.face_to_face__c != ""
FROM volunteers)

But this just gives 'ERROR: zero-length delimited identifier at or near """" Position: 203'

My googling so far leads me to believe that I need to nest a subquery, but... after that, I am lost!

I am using PostgreSQL, and I would happily be pointed to any really super-basic learning resources you could recommend!

  • The issue is `!= ""` this should be `!= ''`. Double quotes are for identifiers e.g. table names, not empty string. This `SELECT COUNT(DISTINCT contacts.id) AS total, COUNT(DISTINCT contacts.id) AS face_to_face` is counting the same thing `contacts_id` for each count so `face_to_face/total` will be `1`. – Adrian Klaver Jun 30 '22 at 22:35
  • you should try to search for the solution *by error message* on Google. duplicate of https://stackoverflow.com/questions/23165282/error-zero-length-delimited-identifier-at-or-near-line-1-delete-from-reg – Nuryagdy Mustapayev Jul 01 '22 at 08:17

0 Answers0