troubleshooting Question

SQL syntax

Avatar of emi_sastra
emi_sastra asked on
SQL
21 Comments2 Solutions253 ViewsLast Modified:
Hi All,

I have below queries:

1. Result one row.
2. Exception. Sub query return more than 1 value ?

What's the problem?

Thank you.


1 . First Query
 
SELECT     A.Nomor_PO, B.Tgl_PO 
FROM         TDPOBELI2009 AS A LEFT OUTER JOIN
                      THPOBELI2009 AS B ON A.Nomor_PO = B.Nomor_PO
WHERE     (A.Nomor_PO = '3115 ')
 
2. Second Query
 
SELECT     A.Nomor_PO, B.Tgl_PO, CASE WHEN YEAR(Tgl_PO) = 2009 THEN
                          (SELECT     Harga_Satuan
                            FROM          SCM_INV..TDPOBELI2009 AS Z
                            WHERE      Z.Nomor_PO = Nomor_PO AND Z.BahanCode = BahanCode) END AS Harga_Satuan_Beli
FROM         TDPOBELI2009 AS A LEFT OUTER JOIN
                      THPOBELI2009 AS B ON A.Nomor_PO = B.Nomor_PO
WHERE     (A.Nomor_PO = '3115 ')
ASKER CERTIFIED SOLUTION
Pratima Pharande

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 21 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 21 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros