SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL 2005 Filling NULLS


SQL 2005 Filling NULLS

Author
Message
bobrots
bobrots
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
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
J.Faehrmann
J.Faehrmann
SSChasing Mays
SSChasing Mays (615 reputation)SSChasing Mays (615 reputation)SSChasing Mays (615 reputation)SSChasing Mays (615 reputation)SSChasing Mays (615 reputation)SSChasing Mays (615 reputation)SSChasing Mays (615 reputation)SSChasing Mays (615 reputation)

Group: General Forum Members
Points: 615 Visits: 1460
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search