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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Transform data through table

Author  Topic 

Bertrand82
Starting Member

7 Posts

Posted - 2012-10-29 : 09:48:00
Hi,

I have a table [tablefruit] with column Fruits
Fruits
Apple
Banana
Orange

I have another table [Fruitexpl] with column Fruit and FruitID

Fruit FruitID
Apple APP
Banana BAN
Orange ORA

I would like to create a Query which Extract all the data from [tablefruit] and transform the data to the FruitID data according to table [Fruitexpl]

What will that statement look like?

Br Bertrand

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-29 : 09:56:21
[code]
SELECT FruitID
FROM Fruitexpl fe
INNER JOIN tablefruit f
ON f.Fruits = fe.Fruit
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

anil_p
Starting Member

3 Posts

Posted - 2012-10-29 : 10:03:06
SELECT b.FruitID FROM Fruitexpl AS a
INNER JOIN tablefruit AS b ON a.Fruits =b.Fruit
Go to Top of Page
   

- Advertisement -