foreign key - sql

  • hi friends,

    my table structure is as follows

    create table validtable

    (

    primary_table varchar(100),

    reference_table varchar(100),

    Primary_Column varchar(100),

    foreign_Column varchar(100)

    )

    insert into validtable values('tblmember','audcallrecords','memberId','memberId')insert into validtable values('tblsystems','audcallrecords','system','system')

    i want to eliminate non related records from the table (reference_table)

    example:

    the table validtable contains all the primary table names and there referenced tables and columns.

    if the table audcallrecords contains any non related tables it shd be elimitated.

    i want to build a query to do this.

    thanks in advance

    vanitha

     

     

     

  • Please provide both tables, and some examples of data in both tables, and then show which result you want from that.

    /Kenneth

  • in the table validtable it stores all the primary table names and referenceing table names along with the column.

    i want to select all the data from the table validtable and eliminate the non related data.

    example

    primary_table   reference_table   Primary_Column    foreign_Column 

    tblmember       audcallrecords      memberId           memberId

    tblsystems      audcallrecords      system               system

    if there is any non related records in the table audcallrecords with tblmember or tblsystems, then we shd eliminate it.

    thanks in advance

    vanitha

     

     

  • Vanitha,

     

    Can u give a small example of which type of data should be removed.

    It would be better if u give sample data for both the Primary table and Reference table. And an example of data which u don't want to enter in the table

     

    Thanks In Advance

    Gowtham

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply