![](/img/trans.png)
[英]Create a complex query from two tables with a hierarchical structure in SQL Alchemy
[英]Complex sql query for only returning another tables data after AND clause
我只能獲取一個表行時遇到問題:
這是我的代碼
cur.execute("SELECT * FROM User_Skills ,User_Profile WHERE User_Skills.UserId = User_Profile.UserId AND User_Profile.country = %s AND User_Profile.state= %s AND USER_Profile.city= %s", (LocAll[0],LocAll[1],LocAll[2]) )
我怎么說。 獲取來自國家 y 的用戶(在個人資料表中找到)並返回用戶技能表中的行。
也就是說,我也不想輸入所有列,例如,如果有 100 列,因此我使用了 *.
不確定這是否是正確的開始方式,或者誰應該更願意使用連接等。
謝謝你。
我想你想知道的就是如何從表中選擇所有列而不用輸入它們。 如果是這樣,請嘗試User_Skills.*
而不是*
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.