I'm trying to get a simple percentage but they keep adding instead of becoming a percentage.
select contract, sum(IIF(subqry.ACCEPTED + subqry.DECLINED=0,0, subqry.ACCEPTED / (subqry.ACCEPTED + subqry.DECLINED))) as RATE
from subqry
where...
Hi all, hopefully an easy one...First, here's my Table
Rec# EMP# timeOUT timeIN
1 4 11:30 12:05
2 4 12:30 --
3 9 11:05 11:15
4 10 11:45 ---
What I'd like to do is when inserting a new record, to check...
Hi all, getting a divide by zero error, even with a CASE statement. Am I missing something?
CASE WHEN SUM(QuantityProduced)= 0 THEN 0 ELSE SUM((QuantityProduced - scrap) / QuantityProduced) end AS QUALITY
fields QuantityProduced and Scrap are both numeric. Using Query analyzer and SQL 2K...
I need to create a query that helps satisfy this:
I need to calculate a monthly savings...easy enough, just divide annual savings by 12. But I need to calculate the annual savings based on the month the project was implemented (DATE field). so, my annual savings for P#1 would be 12,000, whereas...
Can someone point me in the right direction on finding some info on the following? I need to create some queries that will detail the size in KB of all tables, indexes along with their row counts, as well as schema names, table and index names as well. I've searched this forum, BOL, google, but...
Hi all, hoping someone can help with this and let me know if it's even possible: I have a table of training results, which needs to be displayed in a matrix, here's my table and desired output:
table A
EE TMOD LEVEL
1234 first aid 1
1111 first aid...
Hello all. I have a linked server (to an AS400). When I try to view the tables/views from the local server, I see everything fine, however, when I'm not at the local server, and just accessing through a client, when I click on the table/views to see what's there (in EM) it just hangs and doesn't...
Hello all. I have a linked server (to an AS400). When I try to view the tables/views from the local server, I see everything fine, however, when I'm not at the local server, and just accessing through a client, when I click on the table/views to see what's there (in EM) it just hangs and doesn't...
Is there a way I can make bars on graphs appear in a different colour based on the value? I know I can do conditional formatting on the cell, but I want to go one step further and apply it to the graph as well.
"I don't want to sell anything, buy anything or process anything as a career. I...
Hello all, I have 2 tables I'm looking to query. Here's what I have so far:
SELECT S.Machinenumber, S.StartingDate, S.frequency, E.PMdate, CONVERT(varchar(10), DATEADD(dd, S.frequency, E.PMdate), 101) AS NEXTPMDATE,
S.task
FROM dbo.tbl_PM_Schedule S LEFT...
Hi all. I'm trying to make a bulleted list from a database field. Here's my issue: The field is a nvarchar (4000) character field from a MSSQL server, and the bullets need to be placed after each 'responsibility'. I can copy the text from MSWORD to the input page, and it displays the bullets...
Is there any way I can turn the following code into the desired results? I currently only get 'A shift' showing up
DESIRED RESULTS:
shift MON TUES WED THU FRI
A 1.2 3.2 0 0 0
B 0 0 0 0 0
C 0 0 0 0 0
SELECT...
Hi all, hope someone can help me with this one...
I have a view in which I need to display a max date. Here's the structure
EE# TrMod CompDate Vendor
1234 WHMIS 2/4/4 Joe's training
1234 1st Aid 2/5/6 BTC
1234 WHMIS 2/4/6 TCBY
In this case, of...
I'm trying to set schedule a DTS pkg to run, but I keep getting the following error:
Error = -2147217865 (80040E37) Error string: Invalid object name 'tbl_test_DTS'. Error source: Microsoft OLE DB Provider for SQL Server Help file: Help context: 0 Error Detail...
Does anyone know if it's possible to send an email task to outlook from SQL 2000, like when a sproc or trigger fires and email, instead it sends it as an outlook task?
"I don't want to sell anything, buy anything or process anything as a career. I don't want to sell anything bought or...
Looking for some help on this query. I need to count a column (parts) where the stock on hand (SOH) is => the safety stock (SAFETY), then divide that into a count of total parts. Here's table structure
PLANT PART SOH SAFETY
1 abc 50 50
1 xyz 40 50
1...
HI all, How would I create a column indicating the scrap type in the union statement below?
SELECT SUM(CASE datepart(mm, [prddate]) WHEN 1 THEN prdscrap ELSE 0 END) AS JANSCRAP, SUM(CASE datepart(mm, [prddate]) WHEN 2 THEN prdscrap ELSE 0 END) AS FEBSCRAP
FROM tbl_production
WHERE...
Hi everyone, I'm trying to use a query from SQL in Access and am wondering if this is possible.
SELECT division, SUM(CASE datepart('y', [date initiated]) WHEN datepart('y', getdate()) THEN 1 ELSE 0 END) AS CHYTD,
SUM(CASE datepart('m',[date initiated]) WHEN 1 THEN containmenthrs ELSE 0 END)...
Could use a little help on a select statement. Is there anyway I can do a CASE statement to return results that will show a percentage of on time receipts? I'm doing a count of the 'expiredate' for that time frame, and doing a sum of the 'ontime' value, but I want a percent as my final number...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.