本文介绍了我需要linq查询sql查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! SELECT c.companyName,c.companyId,ti.tickerSymbol,e.exchangeSymbol, pt.periodTypeName, fp.fiscalYear ,fd.dataItemId ,di.dataItemName ,fd.dataItemValue FROM ciqCompany c join ciqSecurity s on c.companyId = s.companyId join ciqTradingItem ti ti.securityId = s.securityId join ciqExchange e.exchangeId = ti.exchangeId join ciqLatestInstanceFinPeriod fp on fp.companyId = c.companyId join ciqPeriodType pt on pt.periodTypeId = fp.periodTypeId join ciqFinancialData fd on fd.financialperiodid = fp.financialperiodid join ciqdataitem di on di.dataitemid = fd.dataitemid WHERE fd.dataItemId in ( 3069 ) - - 总收入 AND fp.periodTypeId = 1 和 fp.fiscalyear 在年之间(dateadd(yy,-5,getdate()))和年(getdate()) AND ti.tickerSymbol = ' ibm' AND e.exchangeSymbol = ' Nyse' ORDER BY fd.dataitemid desc ,fp.fiscalYear desc 解决方案 选中此项... LINQ - SQL [ ^ ] 希望这会对你有所帮助。 干杯 我最好的猜测: var query = 来自 c ciqCompany join s in ciqSecurity on c.companyId等于s.companyId join ti in ciqTradingIt em.securityId等于s.securityId join e e.exchangeId上的ciqExchange等于ti.exchangeId join fp in ciqLatestInstanceFinPeriod on fp.companyId equals c.companyId join pt pt.periodTypeId上的ciqPeriodType等于fp.periodTypeId join fd in cdqFinancialData on fd.financialperiodid equals fp.financialperiodid join di 在di.dataitemid上的ciqdataitem等于fd.dataitemi 其中 fd。 dataItemId == 3069 && fp.periodTypeId = 1 && fp.fiscalyear > = DateTime.Today.AddYears(-5)&& fp.fiscalyear < = DateTime.Today&& ti.tickerSymbol = ' ibm'&& e.exchangeSymbol = ' Nyse' 选择 new { c.companyName, c.companyId, ti.tickerSymbol, e。 exchangeSymbol, pt.periodTypeName, fp.fiscalYear, fd.dataItemId, di.dataItemName, fd.dataItemValue }; 如需了解更多信息,请参阅: join子句(C#参考) [ ^ ] 101 LINQ示例 [ ^ ] SELECT c.companyName, c.companyId, ti.tickerSymbol, e.exchangeSymbol, pt.periodTypeName,fp.fiscalYear ,fd.dataItemId ,di.dataItemName ,fd.dataItemValueFROM ciqCompany c join ciqSecurity s on c.companyId = s.companyId join ciqTradingItem ti on ti.securityId = s.securityId join ciqExchange e on e.exchangeId = ti.exchangeId join ciqLatestInstanceFinPeriod fp on fp.companyId = c.companyId join ciqPeriodType pt on pt.periodTypeId = fp.periodTypeId join ciqFinancialData fd on fd.financialperiodid = fp.financialperiodid join ciqdataitem di on di.dataitemid = fd.dataitemidWHERE fd.dataItemId in (3069)---Total Revenue AND fp.periodTypeId = 1 and fp.fiscalyear between year(dateadd(yy,-5, getdate())) and year(getdate()) AND ti.tickerSymbol = 'ibm' AND e.exchangeSymbol = 'Nyse'ORDER BY fd.dataitemid desc, fp.fiscalYear desc 解决方案 Hi,Check this...LINQ - SQL[^]Hope this will help you.CheersMy best guess:var query = from c in ciqCompany join s in ciqSecurity on c.companyId equals s.companyId join ti in ciqTradingItem on ti.securityId equals s.securityId join e in ciqExchange on e.exchangeId equals ti.exchangeId join fp in ciqLatestInstanceFinPeriod on fp.companyId equals c.companyId join pt in ciqPeriodType on pt.periodTypeId equals fp.periodTypeId join fd in ciqFinancialData on fd.financialperiodid equals fp.financialperiodid join di in ciqdataitem on di.dataitemid equals fd.dataitemi where fd.dataItemId == 3069 && fp.periodTypeId = 1 && fp.fiscalyear >= DateTime.Today.AddYears(-5) && fp.fiscalyear <= DateTime.Today && ti.tickerSymbol = 'ibm' && e.exchangeSymbol = 'Nyse' select new { c.companyName, c.companyId, ti.tickerSymbol, e.exchangeSymbol, pt.periodTypeName, fp.fiscalYear, fd.dataItemId, di.dataItemName, fd.dataItemValue };For further information, please see:join clause (C# Reference)[^]101 LINQ Samples[^] 这篇关于我需要linq查询sql查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-20 20:31