April 14, 2009 at 9:16 am
Hi,
I'm learning sql and want to learn more about the functions.
How can I write a statement that will for example add the values of column 1 and 2 and then insert the value into column 3 ??
Thanks,
Matt
April 14, 2009 at 9:47 am
select
x.col1,
x.col2,
'col3' = col1 + col2
from
(select
'col1' = 1 ,
'col2' = 4 ) x
April 14, 2009 at 10:26 am
m.dunster (4/14/2009)
I'm learning sql and want to learn more about the functions.
Functions means user Defined Functions or the Row and Group functions?
April 14, 2009 at 11:01 am
davidandrews13 (4/14/2009)
select
x.col1,
x.col2,
'col3' = col1 + col2
from
(select
'col1' = 1 ,
'col2' = 4 ) x
Hi,
Thanks for the info. Unfortunately I cannot quite understand how this fits together. Let's call the table 'POTS' and then columns 'WIDTH', 'HEIGHT' and 'WEIGHT'
Let's say that I have all the width and height details and the weight = width * height. Can someone please apply this to the above, so I can understand how it all fits together.
Thanks,
Matt
April 14, 2009 at 11:41 am
Do you want to store "width * height" in WEIGHT column??
April 14, 2009 at 5:10 pm
Vijaya Kadiyala (4/14/2009)
Do you want to store "width * height" in WEIGHT column??
Yes, basically. I want actually to do something a bit more exciting, but I just like to understand the solution before implementing it.
Matt
April 14, 2009 at 8:31 pm
Hi
In that case you may want to check out the feature "Computed Columns".
http://www.dotnetvj.com/2009/03/computed-columns-in-sql-server.html
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply