473,395 Members | 1,681 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,395 software developers and data experts.

Select statement within the select statment

1
Below is a statement that give me the results as follows:
--------------------
Tester | Total_Target_Cycle
tester1 | 5
tester2 | 6

I am trying to figure out how i can get total_defects column with only open defects only and percent changet between the target cycle and total defects.

------------------------------------------------------
Tester | Total_Target_Cycle | Total_Defects| % Change
------------------------------------------------------
tester1 | 5
tester2 | 6


HOW TO COMBINE THE TWO STATEMENTS BELOW. THANKS

select BG_detected_by Tester,COUNT(*)Total_Target_Cycle
From Bug
where BG_STATUS = 'Open'and BG_TARGET_RCYC IS NOT NULL
GROUP by BG_DETECTED_BY, BG_STATUS,BG_TARGET_RCYC

select bg_detected_by tester, count(*) Total
from bug
where bg_status = 'Open'
group by bg_status,bg_detected_by
Sep 15 '10 #1
1 1832
amitpatel66
2,367 Expert 2GB
Try this:

Expand|Select|Wrap|Line Numbers
  1. SELECT tester,total_target_cycle,(SELECT COUNT(*) FROM bug where bg_detected_by = x.tester AND bg_status = 'Open') total FROM
  2. (select BG_detected_by Tester,COUNT(*)Total_Target_Cycle
  3. From Bug
  4. where BG_STATUS = 'Open'and BG_TARGET_RCYC IS NOT NULL
  5. GROUP by BG_DETECTED_BY, BG_STATUS,BG_TARGET_RCYC)
  6.  
Sep 20 '10 #2

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

Similar topics

8
by: abbylee26 | last post by:
User enters account number if another account number is needed User clicks add account which creates another row When validating when they hit submit I want to check to make sure they tell us...
2
by: Wenin | last post by:
I have the following list of fields in a table named call. CallID, CallGroupID, PersonID, ParentID, I have two records. 23, 45, John, Null
1
by: luvic.vangool | last post by:
Hi, I'm fairly new to MySql and come from a MS SQL background. I have an application that I am converting from MS SQL to MySql. I need to return a value from MySql using a parameter. In MS...
5
by: JamesHoward | last post by:
I have a problem with python's asyncore module throwing a bad file descriptor error. The code might be difficult to copy here, but the problem is essentially: The server wants to sever the...
4
by: Birky | last post by:
Can someone help me enter a sort statement into the below SQL statement? For the life of me I can not get it to work and I have tried everything I can think of. I just need this stupid thing to sort...
0
Plater
by: Plater | last post by:
I found a few topics on this but nothing that solved my problem. I have a table lets call P (as an example) P has the following usefull fields:...
1
by: BlackMustard | last post by:
hi all, i am currently using the following union select statement to select records from two of my tables to a gridview in asp.net: SELECT ConcertName AS Name, ConcertDate AS Date, ConcertTime AS...
1
by: ebo2006 | last post by:
There are two combo boxes in my form: CORP and CLASS. The WHERE clause of the SELECT statement in the Row Source Property of the CLASS combo box works only every time I start the form. It does not...
6
by: BobRoyAce | last post by:
Let's say that I am performing a bunch of insert/update queries within a transaction that is created as follows: Dim cnn As New SqlClient.SqlConnection(My.Settings.GRPConnectionString)...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.