o数据查询内部联接 [英] oData Query for Inner Join
本文介绍了o数据查询内部联接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在尝试生成一个查询,该查询将在两个表之间具有内部联接,我能够使用oData Query Generator工具来做到这一点,但无法将第二个表中的列包括到我要放入的过滤器中下面用SQL术语更清楚地说明了这一点.
Hello all,
I''m trying to generate a query which will have a inner join between 2 tables, I was able to do that with oData Query generator tool , but was not able to include columns from second table in to the filter I''m putting it more clearly below in SQL terms.
Select a.Col1, a.col2, b.col1, b.col2
from a inner join b
on a.id = b.id
where a.id = @id and b.startdate = @startdate
如何将@startdate参数也添加到oData查询中.
请帮忙.
谢谢.
How can I add @startdate parameter also in to the oData query.
Please help.
Thank you.
推荐答案
查询似乎正确,请将参数@startdate转换为适当的日期格式,如Convert(DateTime,@ startdate,Number).
或尝试使用此
Query seems correct , Please convert parameter @startdate to appropriate date format like that Convert(DateTime,@startdate,Number).
or Try with this
Select a.Col1, a.col2, b.col1, b.col2
from a inner join b
on a.id = b.id
where a.id = @id and Convert(DateTime,b.startdate,103)= Convert(DateTime,@startdate,103)
谢谢
Thanks,
这篇关于o数据查询内部联接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文