作者yshihyu (yshihyu)
看板Python
標題[問題] 關聯式資料表 select 問題
時間Mon May 1 21:30:31 2017
我有兩張表用共用一個ID來查詢
那請想問一下我怎麼同時從兩張表取出欄位資料
我是用DataFrame 做資料庫存取 , 還是我只能分別從資料表出來在對DataFrame 欄位做合併?
#! /usr/bin/python
# -*- coding: utf-8 -*-
import pandas as pd
import sqlite3 as lite
with lite.connect('') as db:
df = pd.read_sql_query("select * from table where ID =
'ID_NUMBER'" , db)
print df
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 175.181.189.156
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1493645435.A.50D.html
推 zerof: Join 05/02 10:48
推 frank910138: SQL Inner join? 05/06 20:37