表a
create table a
(
id int,
name varchar(50),
je money,
primary key(id)
)
表 b
create table b
(
ikey int,
id int,
name varchar(50),
je money,
primary key(iKey)
)
insert a
select 11,'蔥',4.0
union select 22,'蒜',7.0
union select 33,'姜',3.0
insert b
select 1,22,'蒜',5.8
union select 2,22,'蒜',4.8
union select 3,22,'蒜',6.2
在查詢表a的時候,判斷表b里是否有id相同的品,如果有把價格最低的顯示出來如果沒有則還是顯示a表的價格,最終查詢結果
11,'蔥',4.0
22,'蒜',4.8
33,'姜',3.0
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/265221.html
標籤:應用實例
下一篇:open
