如何在SQL查询中匹配数据 [英] how to match data in SQL query
本文介绍了如何在SQL查询中匹配数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我必须从数据库中的表填充GridView.我通过以下查询来填充它(没关系).
Hi all
I have to populate a GridView from a Table in Database. I was populating it by following query (which was ok).
SELECT * FROM EmailTable WHERE empno IN(Select EmpNo from RetiredEmployees) AND disable IS NULL AND deleted IS NULL.
现在我的老板说您应该制作一个RetiredEmployees的Web服务,它将返回一个RetiredEmployees数组.
所以我做到了,现在的问题是我如何交叉匹配SQL语句中ArrayList中的EmpNo.
Now my boss said that you are supposed to make a WebService of RetiredEmployees which will return an Array of RetiredEmployees.
So I made it accordingly, now the problem is how I cross match EmpNo in ArrayList in SQL statement.
SELECT * FROM EmailTable WHERE empno IN(Select EmpNo from RetiredEmployees(Service ArrayList)) AND disable IS NULL AND deleted IS NULL.
在此先感谢
thanks in advance
推荐答案
您有几个选择,请参见此处 [ ^ ].
我个人更喜欢使用XML,但是您会希望找到适合您情况的最佳解决方案.
You have a couple of options, see here[^].
I personally favor using XML, but you''d wand to find the best solution that fits your situation.
感谢您回复Andrew
我自己用一种简单的方法解决了它.我将数组值转换为CSV,从而生成了一个长而混乱的字符串.我将该字符串对象放入SQL中,看起来工作正常,但任何其他想法将不胜感激.
再次感谢,
thanks for replying Andrew
I resolved it myself with an easy way. I converted array values into CSV, which generated a long messy string. I put that string object into SQL, it seems working fine but any other idea will be appreciated.
thanks again,
这篇关于如何在SQL查询中匹配数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文