'SQLite: Selecting all fields with a similar foreign key
I'm new to SQL and the SQLite library and was wondering how to select all fields in a table with a similar foreign key
def retrieveOriginalQes(category):
conn = sqlite3.connect(DBpath)
cursor = conn.cursor()
code = ('SELECT QuestionText from OriginalQuestions WHERE Category = {id}').format(id = category)
cursor.execute(code)
questions = cursor.fetchall()
cursor.close()
return questions
This is what I have currently but it is only returning the first field with that specific foreign key
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|