Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL 2005 Filling NULLS Expand / Collapse
Author
Message
Posted Tuesday, October 15, 2013 9:34 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, October 15, 2013 9:25 AM
Points: 1, Visits: 0
Hello all!

Im trying to get a query to work (well actually a view) so that i get data from table1 (CUCY_DATA) and join some of the columns from table2 (DIMENSIONS). Whenever i do this i get null values. imagine this: you move a car back and forth. Everytime it has been moved forward and backward it stores certain data. When however certain parameters are changed, for instance the force you push the car with or the maximum speed of the car they are stored in a separate table. Now i want to combine both tables but as you can imagine something like this is produced:

|_Movement_|_Time_|_Force_|_Max_Speed_|
| 1 | 3 | 5 | 10 |
| 2 | 3.1 | NULL | NULL |
| 3 | 3.0 | NULL | NULL |
| 4 | 3.1 | NULL | NULL |
| 5 | 3.2 | NULL | NULL |
| 6 | 1.5 | 10 | 15 |
| 7 | 1.6 | NULL | NULL |
| 8 | 1.4 | NULL | NULL |

These NULLS are my problem, i want those to be 5, 10 for the first 5 Movements and 10, 15 for the final 3 Movements.

Can someone help me with this?

Kind regards, Bob
Post #1504826
Posted Wednesday, November 6, 2013 10:14 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, October 10, 2014 5:37 AM
Points: 434, Visits: 1,324
Please provide us with your code and sample data from both tables.
Just guessing from what you write, you left join table2 to table1 with the _Movement_ ID.
You will first need to derive the next _Movement_ ID for each row in table2 and then alter your join condition to between _Movement_ ID and next _Movement_ ID -1.
Post #1511941
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse