Thanks, Dave, I'll see if I can sort it out from that. If not, I'll post again.
The point of the query is to get the URL for a photo. I didn't write it, but the person who did only put it in for Postgres. Seems to be a common theme for me these days...