Right now, I have
SELECT gp_id FROM gp.keywords WHERE keyword_id = 15 AND (SELECT practice_link FROM gp.practices WHERE practice_link IS NOT NULL AND id = gp_id)
This does not provide a syntax error, however for values where it should return row(s), it just returns 0 rows.
What I’m trying to do is get the gp_id from gp.keywords where the the keywords table keyword_id column is a specific value and the practice_link is the practices table corresponds to the gp_id that I have, which is stored in the id column of that table.
I’m not even sure that is valid SQL, so I’m surprised it is working at all:
How about this instead:
I would steer clear of implicit joins as in the other examples. It only leads to tears later.