I try to convert this type of SQL query to Visual Basic in linq, but how can I create a percentage I do not even know how to use linqpad to make this linq please help.
select right (PIC, 3) WHEN '(P)' then 'problem' WHEN '(R)' THEN 'request other requests as' other' [requests / problems] ], COUNT (right (PICName, 3)) amount, convert (decimal (18, 2), convert (decimal (18, 2), COUNT (ticket to ticket), * (surname (3,)) / convert Decimal, 18, 2), (Select Ticket COUNT (Right (PIC, 3)) * 100) AS (% amount) by the Ticket Group on the right (PIC, 3)
I have to export a datagrid like a result:
request / problem Money | amount |% amount -------------------------------------------- ---- ------ problem | 20 | 20.00 requests | 45 | 45.00 other | 35 | 35.00
thanks.
< Div class = "post-text" itemprop = "text">
Let's start by dragging it down for the important part:
SELECT RIGHT (PICName, 3), COUNT (right ( PICName, 3) Amount, COUNT (right, PIC, 3) / (SELECT COUNT (RIGHT) (PIC, 3) by ticket) * 100) by AS (% amount) by ticket group (Pick, 3)
From there, it looks easy:
integer number = db.Tickets.Count (); Select new in TP.com substrings (0,3) G by TB.Ticket Group from var query = db {Requests_Problems = g.Key == "(P)"? "Problem": Yes. K == "(r)"? "Request": "Other", Zodiac = G. Number, perkemount = (g. Number * 100.0) / calculation}
Comments
Post a Comment