473,397 Members | 2,077 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,397 software developers and data experts.

Subtraction confusion

I have a table (Tblmeasures) in a one to many relationship with a personal details table (TBLPatients). Tbl measures contains the responses to a questionnaire taken at two time points (time1 data, time2 data). I want to compare the responses given at the two time points by subtracting the second score from the first score.

I want to present the information something like the below example but I am not sure what the best way to do it is – either an expression in a report or some code or query that calculates the difference and inserts the result into a new field. Either way I am stuck.

Clinic ID is primary key
Q1= question 1 etc

Clinic ID
Time1 data, Q1, Q2, Q3, Q4
Time2 data, Q1, Q2, Q3, Q4
Difference Q1, Q2, Q3, Q4

I would be really grateful for any tips you could offer.

Thanks
PB
Mar 25 '08 #1
1 1356
Stewart Ross
2,545 Expert Mod 2GB
Hi. This kind of analysis is what Excel is good at. It's not as easy to get an SQL-based database to do this, because you need to be able to group rows together (easy enough) then match the rows together for the two different time values and subtract the correct fields from each other (a non-trivial task in SQL). Reason why it is difficult is that SQL is based on set arithmetic, and sets have no inherent order or record position (although of course it is possible to order rows based on the values in particular columns). As a result, matching one timebound set of question results to another is more tricky than is immediately apparent and involves joining the dataset back to itself for the different timebounds.

It is no copout to say that by far the simplest approach is to export the raw data to Excel then use Excel's facilities to do the analysis.

-Stewart
Mar 25 '08 #2

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

Similar topics

1
by: chelleybabyger | last post by:
How do i handle a subtraction between 2 entries in a table? they each belong to 2 tables. my code is below. I wish to subtract ordereditems_quantity from product_stock but i have no idea how to do it...
4
by: August1 | last post by:
I've written an interface and implementation file along with a client source file that allows the use of an overloaded subtraction operator. However, when using the program, I'm running into a...
34
by: Andy | last post by:
Hi, Are 1 through 4 defined behaviors in C? unsigned short i; unsigned long li; /* 32-bit wide */ 1. i = 65535 + 3; 2. i = 1 - 3; 3. li = (unsigned long)0xFFFFFFFF + 3; 4. li = 1...
25
by: bruce.james.lee | last post by:
hi i have a problem with integer subtraction in C. printf("%d", c < (a - b)); a is got from a #define and is 0x80000000 and b is got from input and is also 0x80000000. c is ffffffff (-1). Now,...
5
by: Mark Cave-Ayland | last post by:
Hi everyone, I'm trying to calculate an output column which is the difference of two other columns in the query output; the first column is an aggregate of items in stock, while the second...
2
by: prasadmoyarath | last post by:
If i subtract .01 from 100000000000000 like 100000000000000 - Math.pow(10,(-1 * 2)), i am getting 99999999999999.98. If i cut one zero from the number, result is correct and if i add one more zero to...
3
by: muler | last post by:
hi all, After reading this excerpt from "The C# Programming Language", (By Anders) I tried to check it out. Unfortunately, I'm getting compile errors. Can anyone illustrate this with an...
20
by: junky_fellow | last post by:
Hi, In my previous post I asked if sizeof may be implemented as a function. Somebody pointed a link that says that sizeof may calculated as follows with a warning that it is not guaranteed to...
2
sumaiya
by: sumaiya | last post by:
how can i display date subtraction
5
by: Keflavich | last post by:
Hey, I have a bit of code that died on a domain error when doing an arcsin, and apparently it's because floating point subtraction is having problems. I know about the impossibility of storing...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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,...
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...

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.