From: | tango ward <tangoward15(at)gmail(dot)com> |
---|---|
To: | "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Query ID Values |
Date: | 2018-05-15 01:08:35 |
Message-ID: | CAA6wQLLiPJkHBpH6SKi5QEymC3n-FUKMXm03Msf9Oy4Ut6dK2g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Good Day,
I need to run an SQL query and get a program_id and department_id of a
specific course for each student. I am thinking of running an IF condition
to check if the course name is in program and get it's ID but I don't know
yet where to use the IF condition in the query.
sample code:
for row in cur_t:
course = row['course']
cur_p.execute("""SELECT id from program where name='$[course]']
WHERE department_id=?? """)
Problem is I have 3 department IDs ( Senior High, Vocational, Undergraduate
) and each ID have multiple programs/courses. Each program/course is
connected to the deparment table via department_id.
May I ask an advice on how to approach this?
Thanks,
J
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2018-05-15 01:53:05 | Re: Query ID Values |
Previous Message | Dale Seaburg | 2018-05-14 22:03:02 | Re: Strange error in Windows 10 Pro |