Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Select app.Application_Category as appcat,
SUM(Total_Expected_Availability) as tot_exp_avl,
SUM(Planned_Outage) as tot_pld,
SUM(Unplanned_Outage) as tot_unpld,
SUM(Unplanned_Outage- Unplanned_SignOff) as tot_unpld_sgn,
app.MSL,
app.ESL,
(Sum(Total_Expected_Availability-Planned_Outage-(Unplanned_Outage+Unplanned_SignOff))/SUM(Total_Expected_Availability-Planned_Outage))*100 as perc_achd
from App_Master_2 app
inner join Outage_Metrics outmet on app.Application_Category=outmet.Application_Category and app.Application_ID=outmet.Application_ID
where outmet.Month='9' and outmet.Year='2013'
Group by app.Application_Category,app.MSL,app.ESL


i tried like this but it shows error

maindashboardreport = (from outMet in lstOutage_Metrics
join app in lstApp_Master_2
on outMet.Application_ID equals app.Application_ID
where outMet.Application_Category == app.Application_Category && outMet.Month == monthValue && outMet.Year == yearValue
group app by new { app.Application_Category, app.MSL, app.ESL, outMet.Total_Expected_Availability, outMet.Planned_Outage, outMet.Unplanned_Outage, outMet.Unplanned_SignOff } into g
select new
{
g.Key.Application_Category,
g.Sum(t => t.Total_Expected_Availability).GetValueOrDefault(),
g.Sum(t => t.Planned_Outage).GetValueOrDefault(),
g.Sum(t => t.Unplanned_Outage).GetValueOrDefault(),
(g.Sum(t => t.Unplanned_Outage).GetValueOrDefault() - g.Sum(t => t.Unplanned_SignOff).GetValueOrDefault()),
g.Key.MSL.GetValueOrDefault(),
g.Key.ESL.GetValueOrDefault()
}).Distinct().ToList();

pls help me to fix this..
Posted
Updated 5-Sep-13 6:41am
v2
Comments
Jameel VM 5-Sep-13 12:15pm    
what is the pblm?

sample Linq query which using Join, group, Sum.

var maindashboardreport = (from outMet in lstOutage_Metrics
join app in lstApp_Master_2
on outMet.Application_ID equals app.Application_ID
where outMet.Application_Category == app.Application_Category && outMet.Month == monthValue && outMet.Year == yearValue
group new
{
app.Application_Category,
app.MSL,
app.ESL,
outMet.Total_Expected_Availability,
outMet.Planned_Outage,
outMet.Unplanned_Outage,
outMet.Unplanned_SignOff
} by new
{
app.Application_Category,
app.MSL,
app.ESL
} into g

select new Application_Avail
{
Application_Category = g.Key.Application_Category,
tot_exp_avl = g.Sum(t => t.Total_Expected_Availability).GetValueOrDefault(),// sum(t => t.total_expected_availability).getvalueordefault(),
tot_pld = g.Sum(t => t.Planned_Outage).GetValueOrDefault(),
tot_unpld = g.Sum(t => t.Unplanned_Outage).GetValueOrDefault(),
tot_unpld_sgn = (g.Sum(t => t.Unplanned_Outage).GetValueOrDefault() - g.Sum(t => t.Unplanned_SignOff).GetValueOrDefault()),
MSL = g.Key.MSL.GetValueOrDefault(),
ESL = g.Key.ESL.GetValueOrDefault()
}).Distinct().ToList();
 
Share this answer
 
SQL
select * from PersonInfo
where code
in
(select a.Code from PersonInfo as a ,TradeElamieh as b
where a.Code=b.person1 and b.Actual=1 and (a.Investor_ID like'1338%' or a.Investor_ID like'1339%')
 and b.date>'2012-01-01' and a.Investor_ID IS NOT NULL)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900