下面寫法大錯誤
select distinct * from act inner join pic on act.num=pic.num where num='437'

會產生錯誤訊息:#1052 - Column 'num'  in where clause is ambiguous

原因是因為兩個資料庫的關聯欄位為相同名稱num
所以要用下面方法,把它分別在不同資料表命名成不同名稱(a和b) 

select distinct * from act a,pic b
where a.num='437' and a.num='437';

 

arrow
arrow
    全站熱搜

    cabuchi 發表在 痞客邦 留言(1) 人氣()