anser316 Posted March 30, 2008 Share Posted March 30, 2008 Hi, I have a problem with inserting data into my 'total_stock' table. I want to calculate 'total_stock' by adding all 'stock'. I have been trying to insert data in 'stocks' table, within inserting data in 'total_stock' as i cant add into stock table first as i need the foreign which i havent created. create table total_stock( t_id smallint(2) unsigned not null, total_stock float not null, constraint total_pk primary key (t_id)); create table stocks s_id smallint(2) unsigned not null, stock int not null, t_id smallint(2) unsigned not null, constraint stocks_pk primary key (s_id) constraint stocks_tid_fk foreign key (t_id) REFERENCES total_stock(t_id)); Link to comment https://forums.phpfreaks.com/topic/98620-problem-with-inserting-data-in-tables/ Share on other sites More sharing options...
darkhappy Posted March 30, 2008 Share Posted March 30, 2008 i can't speak for anyone else but i don't understand the question or what specifically you are trying to do - might want to rephrase it or google INSERT INTO.... Link to comment https://forums.phpfreaks.com/topic/98620-problem-with-inserting-data-in-tables/#findComment-504835 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.