Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2005

    Unanswered: 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.

  2. #2
    Join Date
    Oct 2004
    In cousin's house
    why u dont use a store procedure if are using version 5.* and above.

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts