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
 how to find a match and report on it.

Author  Topic 

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2013-10-14 : 19:28:15
my issue is this, this is the record select, in Crystal Reports:

{NOTEH6.UARIDC} = "UA" and

{REFER1.RFCAT} = "0023" and

{OETRA95.OTTRNC} = "001" and etc.

the OTTRNC, we are only taking the 001 values. but we also want to get some other info. this col may be used also for packing materials types, we want on the report. I can't make this in the record select. So I need a type of subreport type of formula.

But was thinking of an SQL statement. Something like this.

SELECT

ASTCCDTA.OETRA95.OTTRNC

FROM

ASTCCDTA.OETRA95

WHERE

ASTCCDTA.oeorh41.ohord# = astccdta.oetra95.otord#

*** now is the tricky part. this bit so far means that we have a good order number that is in use in the report. What it means is that the correction order number is in the order history table and we can report on it.

Now we have to read through oetra95 on this order number and see if any of the OTTRNC, have a value of 'PDB', 'PBB' or 'PWB'. if so, then

we want to print that value on the report. I believe it would only be 1 of them. So once we have a match then we are done. We would need a way to

have this value for the Report.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-10-15 : 00:36:15
[code]
SELECT

o1.OTTRNC

FROM

ASTCCDTA.OETRA95 o1
INNER JOIN ASTCCDTA.oeorh41 o2
ON o1.[otord#] = o2.[ohord#]
WHERE o1.OTTRNC IN ('PDB', 'PBB','PWB')
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -