Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 398
  • Last Modified:

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

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


thanks!!
Fergal
0
fjkilken
Asked:
fjkilken
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
can you show the query you are using currently?

I guess you actually need a LEFT JOIN instead of INNER JOIN, but only guessing..
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
SELECT * FROm
(SELECT Distinct Part_ID  from x ) A
CROSS JOIN
(SELECT Distinct Depot_ID from x ) B
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now