473,513 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3881
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
1643
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 seems to block each other. I use something like this : start thread waiting for connexion with : server.threadserver = threading.Thread(target =...
1
1762
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
58164
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. SELECT a.customer_name, b.customer_name FROM dtb_customer a, dtb_customer b where a.dtb_customer = b.dtb_customer and b.customer > 1
0
503
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 need to know how to add the cost column and get a total . Thanks for any and all help
7
1876
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" type="text/css" media="screen" title="base" />'); }else{ document.write('<link rel="stylesheet" href="~styles/aquarelle.css" type="text/css" media="screen"...
9
6661
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 I created funcion CREATE FUNCTION DB2ADMIN.xxx( )
1
932
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 ('TESTNAME','TESTUSR','TESTPASS',0,0) DB looks like the following: (ID=Autonumber)(Username,Password,UsrName = String)(UsrType,UsrStatus=Number)
1
1996
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 I can not find the proper way to point to the specific tab page and its panel when creating the buttons. I also need to dynamically change the...
17
2685
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 pattern1 print >>orcfilename, line I am pretty sure my code isn't close to what I want. I need to be able
5
1918
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. An example query would be something like: Select * from invoices where year 1995 the query must be updatable and only return say 10 to 100...
0
7177
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7394
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7542
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5701
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4756
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.