SQL Server :: Cannot Reference Column Names To Calculate Percentage
Feb 15, 2011
I have the following SQL:
SELECT SRFILE_1.SRCONMAE, COUNT(LBWF_1.Incidentx) AS SLAFailed,
(SELECT COUNT(Incidentx) AS Expr3
FROM LBWF AS LBWF_2) AS TotalCalls
FROM SRFILE AS SRFILE_1 INNER JOIN
LBWFAS LBWF_1 ON LBWF_1.Incidentx = SRFILE_1.SRONUMBER
WHERE (LBWF_1.KPIFailx = '1') OR
(LBWF_1.Chargex > '0.00') OR
(LBWF_1.LChargex > '0.00')
GROUP BY SRFILE_1.SRCONMAE
What I'm trying to do is divide TotalCalls by SlaFailed and * by 100 into a new variable such as Percentage. However, everytime I try to select SLAFailed or TotalCalls I receive a 'Column Names do not exist' message.
when I use 'RowNumber' = ROW_NUMBER() OVER(ORDER BY ColumnName) then due to orderby Column name consume 76% usage in execution plan . in such case what I have to do? I can see sorting taking much time in execution plan.
I have weekly wise scheduled hours of each employee and no of days scheduled for each employee,now i need to calculate no of employees scheduled less than 24 hours,no of emp's scheduled b/w 24 and 48 hrs and emp's scheduled more than 48 hrs in percentage for fisrt week,second week,3rd week and 4th week.
I have a table that contain the votes(publicVotes) against each contestant. Now what i am trying to do is to calculate the percentage of votes each contestant recieved according to the column SchedularID. how i can get it done and would it be easy to user store procedure or view?
As i am trying to do crystal report task as it is aim is to calculate the Sum Of Subjects Marks And calculate the percentage ....I am not able to calculate the percentage.
I am working on a query to pull the revenue for the last 7 days, as individual days, to be used in a bar graph. My query does what I want it to:
[Code]....
My question is: How do I change the Date1, Date2, Date3, etc to display the actual date it is pulling from? So instead of Date1, it will say "Jan. 3 2011" and so on...
I am using below query to count a particular column data based on single condition.
[code].....
But I have to calculate for 3 more conditions. Is it possible to count based on 3 conditions(i.e. 2001 - 3000,3001 - 4000, 4001 - 5000,>5000) and I want result set for all the conditions?
I have a gridview in which I have a column for Percentage and I enable footer to display the totol of that columnI have in my grid Edit and Delete template column...I need to validate when user click Edit if he inserts a value inside the textbox of a row in the column Percentagenot to exceed the 100 % ..the sum of all rows should be 100 % but i need to validate by a message to ask user :please insert another value cause sum is exceding 100 % then he can clicks on updateI want to validate the data where sum of values of all rows of "Percentage Column" should not exceed 100. If it exceeds more than 100, a pop up window needs to be shown saying "value exceeds 100, Re-enter" and . All of this validation should happen with out a postback.
i have Intime and Outtime of each employee for all the days of 1st,2,3,4 week.There will be a off for 1 day or 2 days for each employees.Based on this i need to calculate consisitency days off assignmanet i.e no of matching days off among employees in percentage.If there are 100 emplyees out of 100 employees 50 people may get week off on the same day(for example sunday).I want result in percentage.result like this
Consistency Days of assignment Across 4 weeks 3 weeks 2weeks 0 2% 0% 0% 1 98% 100% 100% 2 0% 0% 0%
Here 0,1,2 are macthing days off.Across 98% of employees getting 1 days matching in off i.e 98% of employee might off in sunday.For this we need calculate matching days off for all the days from sunday to saturday across 4,3 2 weeks Here 98% of employees getting off in same day.0 indicates 0 days,1 is 1days and 2 is 2 days(for example 50 percentage of people will get off in saturday and sunday)
I would like to select some data from multiple tables and calculate a new column IN the query.In SQL it would look like: (select A, B, ((C * D) + (C * E)) as 'calc' from tab1 join tab2 on.join tab3 on.join tab4 on ...);I've tried this in linq, but it didn't work as I believe.
I have a database with two columns: Retailers or Traders. A row can have only one of them with values while the other must be 'Null'. Both are nvarchars kinds. What I am trying to do is to show data if a radio button is selected for either Retailer or Trader. So I constructed a SelectCommand statement which is getting column names of either 'Retailers' or 'Traders' as a parameter but the SelectCommand statement still returns all records. What can I do?
I am getting a datatable from the SQL Server. In SQL Server the column headers are fine (mix of Capital and Small Letters). But when i am getting it in the front end, all the column names are in lower case. How can i get the column names in original Case.
I have an ASP ListView which I am using to display some pivoted information (across years) in a table. Currently I have the ListView templates defined as:
I tried to query an excel file which contains a lot of customers' information but my problem is most of those don't have a specific column names. E.g. it's in the following format. (Excel File)
A B C Info1 blur blur Info2 blur blur Info3 blur blur
So, when I query using SqlDbDataAdapter, in my DataTable, info1 blur blur becomes column header. e.g. it's in the following format. (DataTable)
Info1 blur blur Info2 blur blur Info3 blur blur
I been working on it so that it actually goes down one row and Change the column name in the DataTable into some appropiate name. Something like the following format.
Is there any way that I could work around it rather than actually going back to change the excel files ? Because I have like 1,000 excel files in that kinda format and seriously giving me headache now.
I've created a Dynamic Data project with an Entity Framework model. It works nicely. But, right now it shows all my database tables with the db column names - which aren't always the most friendly (e.g. address_line_1). How can I got about giving these more friendly column titles that will display to the end user?
I have a requirement to display alphabets above each datagrid column names (like shown in excel). The datagrid columns (and header text) are dynamically created at run time and the alphabets on top could grow like excel A, B, C,....Z, AA, AB, AC,.....AZ etc. Any suggestions on how to get the alphabets showing for each columns?
I just want to calculate the Grand Total of the quantity. So basically i want to sum up all the quantity for each row and show the total at the bottom of the page. I don't want to use the total and the price column in this example. How can i modify this code and just sum up only the total quantity without referencing the price and the total? here is the javascript
<script type="text/javascript"> $(function () { $("[id*=txtQuantity]").val("0"); }); $("[id*=txtQuantity]").live("change", function () { if (isNaN(parseInt($(this).val()))) { $(this).val('0'); } else {