急,求SQL

wangcw791219 2006-06-02 09:23:28
'select Person_No ,person_Name from ST_persons where person_No in'
+'(Select person_No from Em_Cards where Card_balance - Subsidy_Funds<> '
+'(select Top 1 isnull(Card_balance,0) from em_consumerec '
+' where person_No=Em_cards.person_No order by consume_time Desc))';

求怎样把ST_persons.Person_No ST_persons.person_Name Em_Cards.Card_balance em_consumerec.Card_balance 一起查询出来?
...全文
94 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
playwarcraft 2006-06-02
  • 打赏
  • 举报
回复
试试,另外"性欲"是什么东东?还跟这有关???……汗
select A.Person_No ,A.person_Name,B.card_balance,C.card_balance
from ST_persons A
left join Em_Cards B on A.Person_No=B.Person_NO
left join em_consumerec C on B.person_No=C.person_No
where A.person_No in
(Select B2.person_No from Em_Cards B2
where B2.Card_balance - B2.Subsidy_Funds<>
(select Top 1 isnull(C2.Card_balance,0) from em_consumerec C2
where C2.person_No=B2.person_No order by C2.consume_time Desc)
)
Rubi 2006-06-02
  • 打赏
  • 举报
回复
把相关的表结构给出来,不过性欲这么低,埃,有心无力阿
wave_f 2006-06-02
  • 打赏
  • 举报
回复
不能使用嵌套查询了,要用用left join,具体用法sql帮助里面有
terence4444 2006-06-02
  • 打赏
  • 举报
回复
性欲只有69,只能帮你顶一下

2,498

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧