geekisthenewsexy Posted November 6, 2010 Share Posted November 6, 2010 hi guys. i have used this query to display records from the database: SELECT DISTINCT * FROM course,year,block WHERE course.c_id=year.c_id AND year.y_id=block.y_id the records are being displayed in a table form. the records displayed have fields of ID,Course,Year, and Block respectively. in my database, i have 3 tables; course,year,and block. table course has the following fields: c_id, c_name (where c_id is indexed,not unique,auto-incremented table year: y_id, c_id, year (where y_id is unique and auto-incremented, and c_id is a foreign key) table block: b_id, y_id, block (where b_id is unique and auto-incremented, and y_id is a foreign key) now my problem is i don't know how i will going to delete a row of record when i can't base my query on the id on the first table because it's not the primary key. i'm thinking of deleting it with join query but i don't think it's valid and i'm not even sure if there's such a thing. i tried adding another column with some unique and auto-incremented field in every table but it doesn't work because i just found out that a table can only have one column with an auto-incremented field. so i figured asking help from you guys would be a good thing while browsing for some other answers on the web too.. i'd be really grateful if you guys can help me..i've been trying to find answers for days.. :'( Quote Link to comment https://forums.phpfreaks.com/topic/217920-how-to-delete-a-row-of-record-from-database-w-3-tables/ Share on other sites More sharing options...
fenway Posted November 9, 2010 Share Posted November 9, 2010 Which table do you want to delete from? Quote Link to comment https://forums.phpfreaks.com/topic/217920-how-to-delete-a-row-of-record-from-database-w-3-tables/#findComment-1132257 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.