Jump to content

Recommended Posts

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.. :'(

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.