请问怎么用sql语句查询下面的access数据库的表的数据

2025-02-26 04:33:19
推荐回答(2个)
回答1:

select id,country,p_no,msg from product where country=2
union
select * from product where pno in
(select pno from product where pno not in (select pno from product where country=2))

 

这样?

回答2:

不知道是不是这个意思,你可以测试下
select

t.*
from
product t
where
country=2
union all
select
t1.*
from
product t1
where
country=(select min(country) from product t2 where t1.p_no=t2.p_no)
and
p_no not in(select p_no from product where country=2)