I have the following two tables as you can see in the following image:
I would like for example comparing username
(at the session level of each user) of each one to remove their id. I have used the following query
but it does not work SELECT id_medico FROM medico UNION SELECT id_paciente FROM paciente WHERE username=%s
. % S is from pyhton
, since I'm using query
on a page with backend
on pyhton
. The% complete% is this: query
.
So far the returned id is always the same, 1.
Q: I'm using (SELECT id_medico FROM medico WHERE username=%s UNION SELECT id_paciente FROM paciente WHERE username=%s,(username,username))
and pymysql
.