Need to force a repeat value in a SQL select statement:

Posted on 2007-07-25
Last Modified: 2010-07-27
Need to force a repeat value in a SQL select statement:

table x has columns part_id and depot_id
there is a part (abc123) that exists in the UPS_NAMO depot, but not in the UPS_BRZ or UPS_LAR depot

how can I perform a select statement that will return 3 rows as follows, instead of the 1 row that it is currently returning:

part_id    depot_id
=====    ========
abc123  UPS_NAMO
abc123  UPS_LAR
abc123  UPS_BRZ

Question by:fjkilken
    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    can you show the query you are using currently?

    I guess you actually need a LEFT JOIN instead of INNER JOIN, but only guessing..
    LVL 75

    Accepted Solution

    (SELECT Distinct Part_ID  from x ) A
    (SELECT Distinct Depot_ID from x ) B

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    This is my first ever Article on EE or elsewhere; therefore, please bear with me if I have some discrepancies in my writing. I read many articles and questions related to "how to pass values to SSIS packages at run-time?"  Hence, this common ques…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    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…
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

    728 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

    23 Experts available now in Live!

    Get 1:1 Help Now