作业帮 > 综合 > 作业

select distinct A.* from A,B where A.id = B.g_id and A.fwzid

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/05/16 00:28:57
select distinct A.* from A,B where A.id = B.g_id and A.fwzid = 2
我那个地方是写的 select distinct A.* from A,B where A.id B.g_id and A.fwzid = 2
好像就会出错,
select distinct A.* from A,B where A.id = B.g_id and A.fwzid
这样写 distinct A.*,没有这么厉害把,并且在where 那边不想等可以用 not exists
再问: = 于 是没错的。 可是我想用 呢。。 就会有点问题。把所有的记录显示出来,并且重复
再答: 应该不好吧,那是比值把,建议用not exists
再问: 我不会用not exists....求。。
再答: select * from A where id not exists (select g_id from B) and fwzid = 2;不知道行不行,你到网上看看 not exists的用法看看,会有帮助的
再问: 解决了。这样应该可以了 select* from A where id not in(select distinct C.id from A as C,B as D where C.id=D.glry_id) and fwzId =2