Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Multiple Signatures/Rows - I need to return on row

Author  Topic 

gator8869
Starting Member

37 Posts

Posted - 2007-09-12 : 14:28:43
I am getting multiple rows returned because the form that am working with has 4 possible different signtures on it I need to be able to get it so that I can return on row with the a column for the signature and date for each signature



SELECT a.op__docid,
a.order_no, a.deptname, a.order_date, a.person_completing, a.date_req, a.dept_head, a.dept_head_ext,
a.deliver_to, a.vendor_info, a.purchase_reason, a.qty1, a.qty2, a.qty3, a.qty4, a.qty5, a.item1, a.item2,
a.item3, a.item4, a.item5, a.unit_cost1, a.unit_cost2, a.unit_cost3, a.unit_cost4, a.unit_cost5,
a.ext_cost1, a.ext_cost2, a.ext_cost3, a.ext_cost4, a.ext_cost5, a.shipping, a.total,
b.op__tiername, b.op__sectionid, b.op__usersigname, b.op__when,
CASE IF a.op__docid IN (SELECT op__parentid FROM t4w_signatures WHERE a.op__docid = op__parentid AND op__sectionid = 386) AS Requestor,
CASE IF a.op__docid IN (SELECT op__parentid FROM t4w_signatures WHERE a.op__docid = op__parentid AND op__sectionid = 385) AS DeptHead,
CASE IF a.op__docid IN (SELECT op__parentid FROM t4w_signatures WHERE a.op__docid = op__parentid AND op__sectionid = 384) AS Administration,
CASE IF a.op__docid IN (SELECT op__parentid FROM t4w_signatures WHERE a.op__docid = op__parentid AND op__sectionid = 444) AS Receiver

FROM fd__purchase_order a
JOIN t4w_signatures b
ON a.op__docid = b.op__parentid

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-12 : 15:11:23
Yes, you have the IF and CASE statment.
Where is the WHEN (which means which value do you want to return when the CASE IF is true?)



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -