查看單個文章
  #1  
舊 2017-06-30, 12:07 PM
Matt 的頭像
Matt Matt 目前離線
進階會員
 
註冊日期: 2004-02-23
住址: 雲端
文章: 424
預設 找不同table 相同商品的疑問

Mysql
table1
-------+-------
goods iphone8
-------+--------
price 29900




table2

-------+-------
goods iphone8
-------+--------
price 19900

引用:
select goods,price from table1 where (goods in(select goods from table2) and price in (select price from table2))
以table1數據為基礎下
我要找出 在table1.goods 等於 table2.goods 商品,條件是 price 也相同 ,我用上面語法執行後結果有值

goods 是 text
price 是 text
select where in的用法能像我這樣用嗎? 該怎樣用?

此篇文章於 2017-06-30 07:47 PM 被 Matt 編輯。
回覆時引用此篇文章