delete values from a table when joined

Posted on 2014-08-11
Last Modified: 2014-08-11
I am trying to delete orphan objects in my table that I located in the following SQL statement

SELECT r.*,h.*
FROM dbo.tblOrgHours h
             left JOIN tblOrgRegistrations r ON r.RegID = h.RegID  -- Change Foreign Key as appropriate

How would I delete the values found in my tblOrgHours table?
Question by:al4629740
    1 Comment
    LVL 75

    Accepted Solution

    DELETE h
    FROM dbo.tblOrgHours h
                 LEFT JOIN tblOrgRegistrations r ON r.RegID = h.RegID

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    In this article—a derivative of my blog post (—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
    Introduced in Microsoft SQL Server 2005, the Copy Database Wizard ( is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now