473,396 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Want the number that passed the first time.

My Table has a Key called KeyID, and a Foriegn Key called FKey,it has a series of tests mytest and is segmented by a type myType. It has a result of PassFail which is a bit and a date at which it occurred TimeStamp. What I want is how many FKeys passed the first time through the test. This is what I have, but it does not seem correct or proficient.

SELECT
MyType,
myTest,
Count(*) as NumberTested,
Sum(Convert(INT,(PassFail))) as PassedFirstTime

FROM MyTable MT

WHERE (TimeStamp BETWEEN @StartDate AND @EndDate) and MT.GroupID IN
--Narrow it down to the First KeyID by FKey, myTest, and myType
(Select top 1 KeyID from MyTable MT2 where MT.myType = TRG2.myType and TRG2.FKey = TRG.FKey and TRG2.myTest = TRG.myTest order by timestamp)
Group BY myType, myTest
Mar 27 '07 #1
1 968
iburyak
1,017 Expert 512MB
This where condition is totally loosing me:

[PHP]where MT.myType = TRG2.myType and TRG2.FKey = TRG.FKey and TRG2.myTest = TRG.myTest[/PHP]

Where did you get these prefixes?
MT - is an alias from outer table
TRG2 - ?
TRG - ?

I don't see any relation to a table itself which has prefix MT2 in a subquery.
Mar 27 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Douglas | last post by:
Gday, How would I format a number so that: TheValue = 32500 Displays in the TextBox as: $32,500.00
27
by: Mike P | last post by:
I will be passing my function a two dimensional array of varying length. Within that array is one data point, and the number of times it should loop through. So, for example, I might pass this...
6
by: Herrcho | last post by:
in K&R Chapter 6.3 it mentions two methods to calculate NKEYS. and points out the first one which is to terminate the list of initializers with a null pointer, then loop along keytab until the...
4
by: smshahriar | last post by:
Hi, I want to scan from the following string all the hex numbers and populate an array of integers: 0x27 0x00 0x30 0x00 0x33 0x00 0x36 0x00
3
by: hazz | last post by:
The following classes follow from the base class ' A ' down to the derived class ' D ' at the bottom of the inheritance chain. I am calling the class at the bottom, "public class D" from a client...
182
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
7
by: vivekian | last post by:
Trying to write a function which can accept variable number of arguments of the same data type , ranging from 1 ... n . What would be the best way to go about this. Thanks, vivekian
42
by: Holger | last post by:
Hi guys Tried searching for a solution to this, but the error message is so generic, that I could not get any meaningfull results. Anyways - errormessage:...
3
by: Tim Chase | last post by:
I've been trying to come up with a good algorithm for determining the starting and ending dates given the week number (as defined by the strftime("%W") function). My preference would be for a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.