How do I select the values in a database for the names that match a given list?
weightedArray = weightedArray[0:5] print(weightedArray) #these lines select the first 5 values in an array - the 5 hotels with the highest score based off of user input cursor = conn.execute(f"SELECT * FROM romehotels WHERE romehotels.name = {weightedArray[0][0]} OR romehotels.name = {weightedArray[1][0]} OR romehotels.name = {weightedArray[2][0]} OR romehotels.name = {weightedArray[3][0]} OR romehotels.name = {weightedArray[4][0]} ") Top5 = cursor.fetchall() print(Top5) conn.close() This part of the code is supposed to match up the names of the top 5 hotels with their records in the database,
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.