0 Replies Latest reply on Dec 21, 2015 2:13 PM by [email protected]

    How to Find and Delete an Orphaned Record

    Apprentice

      From old forum:

       

      How
      to Find and Delete an Orphaned Record

       

       

      Here is the Query to find orphaned subsets:

      SELECT callid FROM heatuser.Subset WHERE (heatuser.Subset.CallID) NOT IN (SELECT CallId FROM heatuser.CallLog)

       

      This query
      will find orphaned CallLogs records:

      SELECT callid FROM heatuser.CallLog
      WHERE (heatuser.CallLog.CallID) NOT IN (SELECT CallId FROM heatuser.Subset)

       

      This query
      will find orphaned Journal records:

      SELECT callid FROM heatuser.Journal
      WHERE (heatuser.Journal.CallID) NOT IN (SELECT CallId FROM heatuser.Subset)

       

      This query
      will find orphaned Asgnmnt records:

      SELECT callid FROM heatuser.Asgnmnt
      WHERE (heatuser.asgnmnt.CallID) NOT IN (SELECT CallId FROM heatuser.Subset)

       

       

      Here is the Query to delete orphaned subsets:

       

      Here is the Query to delete orphaned subsets:

      Delete FROM heatuser.Subset WHERE (heatuser.Subset.CallID) NOT IN (SELECT CallId FROM heatuser.CallLog)

       

      This query
      will Delete orphaned CallLogs records:

      Delete FROM heatuser.CallLog
      WHERE (heatuser.CallLog.CallID) NOT IN (SELECT CallId FROM heatuser.Subset)

       

      This query
      will delete orphaned Journal records:

      Delete FROM heatuser.Journal
      WHERE (heatuser.Journal.CallID) NOT IN (SELECT CallId FROM heatuser.Subset)

       

      This query
      will Delete orphaned Asgnmnt records:

      Delete FROM heatuser.Asgnmnt
      WHERE (heatuser.asgnmnt.CallID) NOT IN (SELECT CallId FROM heatuser.Subset)