Skip to main content

Hello,

 

I have problem with SQL in Quick Report. I write this SQL query: 

 

SELECT CASE 
           WHEN COUNT(CASE WHEN parent_part_status <> 'B' THEN 1 END) = 0 THEN 0
           ELSE NULL
       END AS result
FROM MANUF_STRUCTURE
WHERE component_part = :component_part
GROUP BY component_part;    this retrieves nothing in both comp parts) 

 

SELECT CASE 
           WHEN COUNT(CASE WHEN parent_part_status <> 'B' THEN 1 END) = 0 THEN 0
           ELSE NULL
       END AS result
FROM MANUF_STRUCTURE
WHERE component_part = ‘U010805’
GROUP BY component_part;     (retrieves 0, which is good)

 

SELECT CASE 
           WHEN COUNT(CASE WHEN parent_part_status <> 'B' THEN 1 END) = 0 THEN 0
           ELSE NULL
       END AS result
FROM MANUF_STRUCTURE
WHERE component_part = ‘U010751’
GROUP BY component_part;     (retrieves nothing, which is good)

 

I am using tab → component where used, every component part has some part numbers and every part number has parent_part_status, which belongs in 2 categories - B,A (blocked, active). My problem is when i want to input in “:component_part” item U010805, which has 4 part no and every part_no has parent_part_status = B => in this case I want to display in new columns “Has superior part” 0. And I have second component part U010751 which has 4 part no with parent_part_status = B and two part no with parent_part_status = A, in this case i want to display nothing (NULL value). But problem is when I input this dynamically in “:component_part”, in both case returns nothing. 

 

 

I also tried to find column Buildable Structures Only in SQL, but I cant find it, so I dont know if this component is working only with parent_part_status

How can I solve this?

Thanks

Hi Ed,

hmmm, I’m not quite shure if I understand your requirement.
Let me describe it with my own words:

Your focus is the component_part (cp)
Your question is:
To what part_no this component_part belongs to?
So:
part_no 1

 cp1
 cp2
 etc

part_no 2
  cp1

  cp4
  cp5 etc.

Now:
When you ask: Which CP belongs to a part_no with parent_part_status = Blocked
you need at least one more group by.

By the way:
I use MS SQL and a linked server to connect to ORACLE:

Hmmm,
you count so perhaps you want to know “In how many parents the CP takes place?”

HTH

Michael
 


Reply