帮助t-SQL Select for .NET Multi select Dropdownlist [英] Help with t-SQL Select for .NET Multi select Dropdownlist

查看:129
本文介绍了帮助t-SQL Select for .NET Multi select Dropdownlist的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的网站构建一种属性搜索查询。



我到目前为止:

我的网站上有一个多选下拉列表,其中包含一个城市内的社区。我通过逗号分隔列表(varchar)将该下拉列表的选定ID传递给存储过程。然后我使用用户定义函数拆分这些值,这会给我一个名为ID的simgle列,其中包含每个选定值的行。

EXP:



ID

---

2

3

4

6

8



我的查询:

我的表有很多属性这些每个属性都位于其中一个区域中,因此每个属性都有一个Area_ID。当然,许多属性可以属于一个类别。

我需要带回所有属于所选区域的属性。



基本上我很困惑我将如何处理这个问题。加入,临时表,IN等等。



任何帮助表示赞赏



Jay

解决方案

如果你的UDF给你一张桌子..



 选择 xxx 来自属性 AS  P  join  theUDFTable  AS  U   P.Area_Id = U.AreaID 


I am trying to construct a sort of "Property Search" Query for my site.

Where I am so far:
I have a multi select dropdownlist on my site that contains "Neighborhoods" within a city. I am passing the selected IDs of that dropdown to a stored proc via a comma delimited list (varchar). I am then splitting those values using a User Defined Function which give me back a simgle column called ID that contains a row for each selected value.
EXP:

ID
---
2
3
4
6
8

My Query:
I have a table that has many "Properties" These properties each reside within one of the "Areas", so each has an Area_ID. Of course many properties can belong to a category.
I need to bring back all of the properties that belong to all of the "Areas" that were selected.

Basically I am confused on how I should approach this query. Joins, Temp table, Where IN, etc.

Any help is appreciated

Jay

解决方案

If your UDF gives you back a table..

Select xxx from Properties AS P join theUDFTable AS U on  P.Area_Id = U.AreaID


这篇关于帮助t-SQL Select for .NET Multi select Dropdownlist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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