Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Maccaman
Starting Member
16 Posts |
Posted - 2010-01-30 : 00:30:52
|
| Hi,I have two tables I'm trying to join, but I don't know which join to use, and what to join them on.My first table (called TempData) is a list of average temps per season:Temperature Season38 Summer26 Fall15 Winter32 SpringMy Second Table (called SeasonSequence) consists of each season and a sequence number:Season2 SequenceNoSummer 1Summer 2Summer 3Summer 4Fall 4Fall 1Fall 2Fall 3Winter 3Winter 4Winter 1Winter 2Spring 2Spring 3Spring 4Spring 1Im trying to join these tables so that I obtain the following Table:Temperature Season Season2 SequenceNo38 Summer Summer 126 Fall Summer 215 Winter Summer 332 Spring Summer 438 Summer Fall 426 Fall Fall 115 Winter Fall 232 Spring Fall 338 Summer Winter 326 Fall Winter 415 Winter Winter 132 Spring Winter 238 Summer Spring 226 Fall Spring 315 Winter Spring 432 Spring Spring 1I thought a union would have done this, but when I try I get an error: Error converting data type varchar to float. Im probably wrong about the union though. Any help would be greatly appreciated.Thanks"I know the human being and fish can co-exist peacefully" - George W. Bush. Obviously Mr Bush has never been fishing with me :) |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-01-30 : 00:38:05
|
how is the 1st table related to the 2nd table ?how do you want to join these 2 tables ? Based on what condition ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2010-01-31 : 09:41:14
|
| You mean joining based on Season. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-01-31 : 09:53:33
|
That looks senseless to me if every season has the same average temp .Can you make more clear why you want to do this? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|