Can somebody please explain to me what is wrong with this query and what it gives me 0 rows

SELECT id, name, url FROM drive_file WHERE 'drive_file.userId ' LIKE '7tin655pe6'

@matrix Is drive_file.userId supposed to be surrounded by ' '? (plus there is a space between the name and the second '.)

@trinsec Without ' ' it says
ERROR: column drive_file.userid does not exist
LINE 1: SELECT id, name, url FROM drive_file WHERE drive_file.userId...
^
HINT: Perhaps you meant to reference the column "drive_file.userId".

Follow

@matrix Then maybe that trailing space is the culprit, otherwise try the double quotes (") instead?

@trinsec Neither works, removing the space does nothing and using double quotes causes this error:
ERROR: column "drive_file.userId" does not exist
LINE 1: SELECT id, name, url FROM drive_file WHERE "drive_file.userI...

@matrix I'd have gone either

SELECT id,name,url FROM drive_file WHERE userId LIKE '%blabla%'
(% is a wildcard, LIKE is not for precise matching)

or

SELECT id,name,url FROM drive_file WHERE userId = 'blabla'

Other than that my knowledge's rusty, I need to get back to devving and databases someday.

@trinsec I originally went for those too, but they didn't work.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.