stevieontario Posted May 1, 2009 Share Posted May 1, 2009 Hello everyone, I have two tables (Table A and Table B) and want to define Field B2 in Table B so that it multiplies the contents of Field B1 in Table B with the content of Field A2 in Table A. Is this possible? Quote Link to comment https://forums.phpfreaks.com/topic/156415-how-to-put-an-automatic-arithmetic-operator-into-a-table-column/ Share on other sites More sharing options...
kickstart Posted May 1, 2009 Share Posted May 1, 2009 Hi Sounds like you are thinking of a view (basically a pseudo table taking info from other tables). All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/156415-how-to-put-an-automatic-arithmetic-operator-into-a-table-column/#findComment-823523 Share on other sites More sharing options...
Ken2k7 Posted May 1, 2009 Share Posted May 1, 2009 Well, I hope both tables have corresponding values, which also means both tables have the same number or rows. INSERT INTO `table_b` (`field_b2`) SELECT `b`.`field_b1` + `a`.`field_a2` AS `field_b2` FROM `table_b` b, `table_a` a Not tested. Quote Link to comment https://forums.phpfreaks.com/topic/156415-how-to-put-an-automatic-arithmetic-operator-into-a-table-column/#findComment-823531 Share on other sites More sharing options...
fenway Posted May 1, 2009 Share Posted May 1, 2009 Clearly not tested -- there's no join condition. Quote Link to comment https://forums.phpfreaks.com/topic/156415-how-to-put-an-automatic-arithmetic-operator-into-a-table-column/#findComment-823559 Share on other sites More sharing options...
stevieontario Posted May 1, 2009 Author Share Posted May 1, 2009 Thanks everyone, Maybe View will solve my problem, thanks Keith. Thanks also to Ken and Fenway. Fenway, I take your point, and I'll post info on version, table structure etc. asap. Quote Link to comment https://forums.phpfreaks.com/topic/156415-how-to-put-an-automatic-arithmetic-operator-into-a-table-column/#findComment-823669 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.