import UIKit
class ViewController: UIViewController, UIScrollViewDelegate {
var scrollView: UIScrollView = UIScrollView()
var viewInScrollView: UIView = UIView()
var selectedImageView: UIImageView = UIImageView()
override func viewDidLoad() {
super.viewDidLoad()
scrollView.delegate = self
view.addSubview(scrollView)
scrollView.addSubview(viewInScrollView)
viewInScrollView.addSubview(selectedImageView)
selectedImageView.image = UIImage(named: "michael")
scrollView.translatesAutoresizingMaskIntoConstraints = false
viewInScrollView.translatesAutoresizingMaskIntoConstraints = false
selectedImageView.translatesAutoresizingMaskIntoConstraints = false
scrollView.anchor(top: view.safeAreaLayoutGuide.topAnchor, leading: view.leadingAnchor, bottom: view.bottomAnchor, trailing: view.trailingAnchor)
viewInScrollView.anchor(top: view.safeAreaLayoutGuide.topAnchor, leading: view.leadingAnchor, bottom: view.bottomAnchor, trailing: view.trailingAnchor)
viewInScrollView.widthAnchor.constraint(equalToConstant: view.frame.width).isActive = true
viewInScrollView.heightAnchor.constraint(equalToConstant: view.frame.height).isActive = true
selectedImageView.anchor(top: viewInScrollView.topAnchor, leading: viewInScrollView.leadingAnchor, bottom: viewInScrollView.bottomAnchor, trailing: viewInScrollView.trailingAnchor)
}
func viewForZooming(in scrollView: UIScrollView) -> UIView? {
return selectedImageView
}
}
当前情况:
我想要的是:
我将解释我想要什么:上面的查询仅从declare @nodeid int = '1';
with cte as
(
select
cust_ID, name, null lnode, null rnode
from
user_detail
where
cust_ID = @nodeid
union all
select
t.cust_ID, t.name,
isnull(cte.lnode, case when t.joinside = 0 then 1 else 0 end)
lnode,
isnull(cte.rnode, case when t.joinside = 1 then 1 else 0 end),
rnode
from
user_detail t
inner join
cte on cte.cust_ID = t.parentid
)
select
cust_ID, name
from
cte
where
rnode = '0'
option (maxrecursion 0)
表中获取结果。我想以某种方式修改查询,使其也在user_detail
表中搜索相应installments
的{{1}}列。
修改后的查询将基于status
从分期付款表中获取状态值。
查询将在第三列显示结果,如第二个屏幕截图所示。
我对CTE和嵌套查询不是很熟悉。我希望你们能理解我的问题。
答案 0 :(得分:0)
您可以在下面尝试-
declare @nodeid int = '1';
with cte as (
select cust_ID, name,null lnode, null rnode from user_detail where
cust_ID = @nodeid
union all select t.cust_ID,t.name, ISNULL(cte.lnode, CASE WHEN t.joinside =
0 THEN 1 ELSE 0 END)
lnode, ISNULL(cte.rnode, CASE WHEN t.joinside = 1 THEN 1 ELSE 0 END)
rnode from user_detail t inner join cte on cte.cust_ID = t.parentid )
select cust_ID,name,status from cte c
inner join installment i on c.cust_id=i.cust_id
where rnode='0'
option (maxrecursion 0)
答案 1 :(得分:0)
最后,您可以加入wvery table
select
cust_ID, name ,Table.status
from cte
Join Table on Table. cust_ID = cte.cust_ID
where
rnode = '0'