来自另一个存储的存储参数 [英] Stored parameter from another stored

查看:64
本文介绍了来自另一个存储的存储参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有三个表:maingroup,subgroup和mobile.我想显示属于特定主组的所有子组中的所有手机.
请问我该怎么做?
谢谢

Hi all,

I have three tables :maingroup, subgroup and mobile. I want to display all mobiles from all subgroups that belong to a specific main group.
How can I make that, please?
Thanks

alter proc mobile_select
(@maingroupid int)
as
begin
select mobile
from tbl_mobile, tbl_maingroup, tbl_subgroup
where
tbl_maingroup.maingroupId=@maingroupid  and
tbl_maingroup.maingroupId=tbl_subgroup.maingroupId
end

推荐答案

您忘记为tbl_mobile赋予条件了.
除非您指定该条件,否则它将返回所有数据.
You forgot to give condition for tbl_mobile.
Unless you specify that condition, it will return all data.


您尚未为Mobile表放置任何条件.更新where子句,它将起作用.
You have not placed any condition for the Mobile table. Update the where clause and it will work.


<pre lang="sql">alter proc <pre lang="sql">alter proc mobile_select<br />
(@maingroupid int)<br />
as<br />
begin<br />
select mobile<br />
from tbl_mobile, tbl_maingroup, tbl_subgroup<br />
where<br />
tbl_maingroup.maingroupId=@maingroupid  and<br />
tbl_maingroup.maingroupId=tbl_subgroup.maingroupId and<br />
tbl_mobile.subgroupId=tbl_subgroup.subgroupId<br />
end</pre><br />


这篇关于来自另一个存储的存储参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆