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

Query with subquery returns only column names, no data

I have been working on this query for hours and all I can return are the column headers! What I need to return is an average for each marker, by date, for each subject. There are multiple dates for each marker and date. Thanks in advance for any help!!!


Expand|Select|Wrap|Line Numbers
  1.  USE ALS_Smash_BBP
  2.    GO
  3.  
  4.    SELECT BBP1.SubjectID
  5.         , BBP1.clinicdate
  6.         , AVG(BBP1.MaxSpd) AS MaxSpd_JR_RBHo
  7.         , AVG(BBP2.MaxSpd) AS MaxSpd_LL_JRo
  8.         , AVG(BBP3.MaxSpd) AS MaxSpd_LL_RBHo
  9.         , AVG(BBP4.MaxSpd) AS MaxSpd_RC_LCo
  10.         , AVG(BBP5.MaxSpd) AS MaxSpd_UL_RBHo
  11.         , AVG(BBP6.MaxSpd) AS MaxSpd_UL_LLo
  12.         , AVG(BBP7.MaxSpd) AS MaxSpd_UL_RC_LL_LCo
  13.    FROM
  14.     dbo.BBP_JerkCost_STATS051810 BBP1
  15.         JOIN dbo.BBP_JerkCost_STATS051810 BBP2 ON BBP1.SubjectID = BBP2.SubjectID 
  16.         JOIN dbo.BBP_JerkCost_STATS051810 BBP3 ON BBP1.SubjectID = BBP3.SubjectID 
  17.         JOIN dbo.BBP_JerkCost_STATS051810 BBP4 ON BBP1.SubjectID = BBP4.SubjectID 
  18.         JOIN dbo.BBP_JerkCost_STATS051810 BBP5 ON BBP1.SubjectID = BBP5.SubjectID 
  19.         JOIN dbo.BBP_JerkCost_STATS051810 BBP6 ON BBP1.SubjectID = BBP6.SubjectID
  20.         JOIN dbo.BBP_JerkCost_STATS051810 BBP7 ON BBP1.SubjectID = BBP7.SubjectID 
  21.  
  22.         WHERE   
  23.     (BBP1.SubjectID = '0069' and BBP1.Marker = 'JR_RBHo')
  24.    or (BBP1.SubjectID = '0069' AND BBP2.marker = 'LL_JRo' )
  25.    OR (BBP1.SubjectID = '0069' AND BBP3.marker = 'LL_RBHo')
  26.    OR (BBP1.SubjectID = '0069' and BBP4.marker = 'RC_LCo')
  27.    OR (BBP1.SubjectID = '0069' AND BBP5.marker = 'UL_RBHo') 
  28.    OR (BBP1.SubjectID = '0069' AND BBP6.marker = 'UL_LLo') 
  29.    OR (BBP1.SubjectID = '0069' AND BBP7.marker = 'UL_RC_LL_LCo' ) 
  30.  
  31. GROUP BY BBP1.SubjectID 
  32.         , BBP1.ClinicDate
May 27 '10 #1

✓ answered by Delerna

You are probably only getting column headings because there is no data in the table that matches the criteria of your query

If you remove all of the where conditions do you get data back?
Trying to narrow down where the query is loosing the data here.
I can't see your data so I can't tell

2 2286
Delerna
1,134 Expert 1GB
You are probably only getting column headings because there is no data in the table that matches the criteria of your query

If you remove all of the where conditions do you get data back?
Trying to narrow down where the query is loosing the data here.
I can't see your data so I can't tell
May 31 '10 #2
Ah..you were so right! I worked backwards and found that I had a stinkin' typo in my condition! After that...slick! Thanks for the help! Rookie mistake!
Jun 1 '10 #3

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

Similar topics

2
by: Joe Gazda | last post by:
I'm a relative newbie to PHP, but have been able to put together some PHP code to generate a CSV/XLS file from a Query result. Now, I would like to include custom column names instead of the MySQL...
1
by: noor | last post by:
Hi I have been working since 2 days to device a method to export sql table into csv format. I have tried using bcp with format option to keep the column names but I'm unable to transfer the file...
0
by: Sara | last post by:
We have a Cobol stored procedures on DB2 OS/390. We are able to access the stored procedures from a distributed platform Windows 2000/ Linux / Unix using DB2 Connect. But it does not return column...
2
by: Piotr Kurpiel | last post by:
Hello, I am using MS Access 2003 with VBScript. I have quite strange column names which are: 1,2,3,4,etc... Data Types of the columns are Yes/No and formats True/False. The first thing I want to...
6
by: phillip.s.powell | last post by:
update student s set school_year_id = (select distinct s.id from school_year s, interns i where lower(s.school_year_name) = lower(i.enrollment_year)and s.unique_key = i.unique_key group by s.id);...
1
by: abbaskhan | last post by:
Actuall in this query i am trying to to compare the monthly change percentage i ,e january 2007 aganest dec 2006 and the value is available in one table and same column one below the other when...
14
Boxcar74
by: Boxcar74 | last post by:
Ok I don’t know if this is possible. I Know SQL Ok and it’s been a while since I worked with VB. But what I’m trying to do is query by the dates in the column names. For instance I'm tracking...
1
by: christianlott1 | last post by:
I want to provide users with an interface to create a custom merge (all in Access, not Word). User will put in a set of brackets ("<>") in a memo field and when they click the merge button it will...
4
by: arunmen | last post by:
Hi folks, I have an situation like I have an table named Location where by it stores all the details of location. In the table I have 2 columns State, city where by I have some duplicate values...
1
by: bugs2bugs | last post by:
Hello, We're using SQL Server 2000 and Query Manager (not Visual Studio). When your query results are returned, the column names are displayed at the top, but this information is NOT available for...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.