How to populate parent column by child column.

IriZe

New member
Joined
Oct 4, 2012
Messages
2
Programming Experience
Beginner
I created a relation between two tables with one column, and i want to populate the parent column by the child column's values. Is there an easy, one row code for this?
 
Your question doesn't actually make sense as asked. If you have a relation then it's values from the parent column that you insert into the child column. There's no mystery to it. If you want a value in the child column then you put it in there. Presumably you want more than that but you haven't provided an adequate explanation.
 
So, in depths, i want to create 3 tables, lets name them: Points, KnownPoints, UnknownPoints, and add a column named "PointID" to them.

The Points would be a parent table that contains all the values KnownPoints and UnknownPoints have.

For this, to avoid exception, i have to fill the parent table with all the values before i add them to the 2 child tables. But i want the opposite: I want that the 2 child tables update the parent table. If i write anything to a child's primary key, i want it to be added to the parent's primary key column, thus it'd integrate the two children.

I could set up a subroutine for this that adds the value first to the parent, and then to the child table, but i wonder if there is an easy, one line way to do it.
 
Wouldn't it be easier to have just one table with a Boolean IsKnown column? If you really must go the way you described then, if you're using a database that supports it, you can set up a trigger.
 
Yes there is, go to ms access and design a query. After, view the it's SQL query statement then use it to join data's from two tables in one row query.
 
Back
Top