If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Inserting formulas in tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-09-05, 18:14
Luc4 Luc4 is offline
Registered User
 
Join Date: Dec 2005
Posts: 7
Inserting formulas in tables

Hi. I have something pretty simple to do. I have to tell MySQL to calculate a field as a function of another field. For instance, the user instert a value for field f1 and I want field f2 to be computed as 10*f1 or as a function of a field of a view. I tried looking up for this in the MySQL manual but I can't find it. Could someone please address me to the right place? I'm Italian so maybe I'm searching with wrong keywords. I found something useful here in these forums, but unfortunately it was for SQL Server.
Thanks to everyone.
Reply With Quote
  #2 (permalink)  
Old 12-09-05, 20:43
popskie popskie is offline
Registered User
 
Join Date: Oct 2004
Location: In cousin's house
Posts: 303
why u dont use a store procedure if are using version 5.* and above.
eg.

create procedure ProcedureName(in Tfield1 int,in Tfield2 int)
begin
insert into tablename(field1,field2)values(TField1,Tfield2*10) ;
end
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On