473,413 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

newbe how to add a column

I need to know how to add a column of numbers and get a total using my sql
command.

SELECT v.vid, title, purchdate, sum(cost) AS Total
FROM Video v, Vidcopy vc
WHERE vid.v = vid.vc

I need to know how to add the cost column and get a total .

Thanks for any and all help


Jul 19 '05 #1
4 3879
I'm not sure what you have and want.
To add a cost field to a table do "alter table Video cost float(10,2)".
Note that once you add sum(cost) to the query, you get one line back sum of
all costs...unless you add some grouping clause.
Tell us your schema of the 2 tables and what you mean by "sum" like per
video or entire table, and we'll have more to go on.
dp

"Michael Lewandowski" <mi*******@charter.net> wrote in message
news:vn************@corp.supernews.com...
I need to know how to add a column of numbers and get a total using my sql
command.

SELECT v.vid, title, purchdate, sum(cost) AS Total
FROM Video v, Vidcopy vc
WHERE vid.v = vid.vc

I need to know how to add the cost column and get a total .

Thanks for any and all help


Jul 19 '05 #2
I'm not sure what you have and want.
To add a cost field to a table do "alter table Video cost float(10,2)".
Note that once you add sum(cost) to the query, you get one line back sum of
all costs...unless you add some grouping clause.
Tell us your schema of the 2 tables and what you mean by "sum" like per
video or entire table, and we'll have more to go on.
dp

"Michael Lewandowski" <mi*******@charter.net> wrote in message
news:vn************@corp.supernews.com...
I need to know how to add a column of numbers and get a total using my sql
command.

SELECT v.vid, title, purchdate, sum(cost) AS Total
FROM Video v, Vidcopy vc
WHERE vid.v = vid.vc

I need to know how to add the cost column and get a total .

Thanks for any and all help


Jul 19 '05 #3
correct alter syntax (adding the word "add") "alter table Video add cost
float(10,2)".
"D. Pickering" <dc*****@hps.com> wrote in message
news:Hd*********************@newssvr30.news.prodig y.com...
I'm not sure what you have and want.
To add a cost field to a table do "alter table Video cost float(10,2)".
Note that once you add sum(cost) to the query, you get one line back sum of all costs...unless you add some grouping clause.
Tell us your schema of the 2 tables and what you mean by "sum" like per
video or entire table, and we'll have more to go on.
dp

"Michael Lewandowski" <mi*******@charter.net> wrote in message
news:vn************@corp.supernews.com...
I need to know how to add a column of numbers and get a total using my sql command.

SELECT v.vid, title, purchdate, sum(cost) AS Total
FROM Video v, Vidcopy vc
WHERE vid.v = vid.vc

I need to know how to add the cost column and get a total .

Thanks for any and all help



Jul 19 '05 #4
correct alter syntax (adding the word "add") "alter table Video add cost
float(10,2)".
"D. Pickering" <dc*****@hps.com> wrote in message
news:Hd*********************@newssvr30.news.prodig y.com...
I'm not sure what you have and want.
To add a cost field to a table do "alter table Video cost float(10,2)".
Note that once you add sum(cost) to the query, you get one line back sum of all costs...unless you add some grouping clause.
Tell us your schema of the 2 tables and what you mean by "sum" like per
video or entire table, and we'll have more to go on.
dp

"Michael Lewandowski" <mi*******@charter.net> wrote in message
news:vn************@corp.supernews.com...
I need to know how to add a column of numbers and get a total using my sql command.

SELECT v.vid, title, purchdate, sum(cost) AS Total
FROM Video v, Vidcopy vc
WHERE vid.v = vid.vc

I need to know how to add the cost column and get a total .

Thanks for any and all help



Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sebastien GIRAUD | last post by:
Hello, First let say that am french and that i'll try to write the best english i can... I'm a python newbe and have the following problem : I try to create 2 threads in a server program and they...
1
by: Ron | last post by:
Is this built into any of the python versions? Need it! Using 2.3.5 and doesn't seem to have it.Newbe needs help!email ron@nac.net Thanks Ron
6
by: Nimesh | last post by:
I need to find customer's names that repeat / occur more than once in the same table. I have treid many options and I have tried comparing the column to itself but Oracle gives me an error. ...
0
by: Michael Lewandowski | last post by:
I need to know how to add a column of numbers and get a total using my sql command. SELECT v.vid, title, purchdate, sum(cost) AS Total FROM Video v, Vidcopy vc WHERE vid.v = vid.vc I...
7
by: Jean Pierre Daviau | last post by:
Hi, <script language="javascript" type="text/javascript"> if(navigator.appName.indexOf("Netscape") != -1){ document.writeln('<link rel="stylesheet" href="~styles/aquarelle_ns.css"...
9
by: Yaro | last post by:
Hello DB2/NT 8.1.3 Sorry for stupid questions. I am newbe in DB2. 1. How can I read *.sql script (with table and function definitions) into a database? Tool, command... 2. In Project Center...
1
by: Ryan Smith | last post by:
I am trying to insert data into an access 2k3 db and receive an invalid syntax message. The statement is: INSERT INTO Users (UsrName,Username,Password,UsrStatus,UsrType) VALUES...
1
by: Jim | last post by:
I have created a windows form that contains several tab pages which contain a panels. On a tab page I am trying to dynamically create a series of buttons in that pages panel. I am failing because...
17
by: Eric_Dexter | last post by:
def simplecsdtoorc(filename): file = open(filename,"r") alllines = file.read_until("</CsInstruments>") pattern1 = re.compile("</") orcfilename = filename + "orc" for line in alllines: if not...
5
by: troy | last post by:
Could someone please point me in the right direction on how to read in a large query with .net. I am trying to emulate a legacy database system so I don't know the upper bounds of the sql query....
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.