Skip to main content
Answer

Problem in WHERE condition

  • November 10, 2025
  • 2 replies
  • 62 views

Forum|alt.badge.img+10
  • Sidekick (Customer)

Hello, I want to create a new CF in QMAN_CATEGORICAL_RESULTS, but I am not sure what should I add as WHERE parameter. In entity configuration is in additional views view QMAN_CATEGORICAL_RESULTS, but I cant use order_no, neither part_no, only objkey, but this retrieves wrong values. I thought that I can use any of the column which is in additional view table, but thats not true. 

Best answer by ArcPierreL

Hi, 

This requirement can be covered with a subquery to fetch the OrderNo connected to the QMAN_CATEGORY_SAMPLE_VALUE record. However can you tell me what is the exact business requirement behind this as what you have written does not make sense to me.

Pierre

FYI : 
SELECT COUNT(qcr1.ORDER_NO)
FROM QMAN_CATEGORICAL_RESULTS qcr1
WHERE qcr1.ORDER_NO = (
    SELECT qcr2.ORDER_NO
    FROM QMAN_CATEGORICAL_RESULTS qcr2
    WHERE qcr2.ANALYSIS_NO = :ANALYSIS_NO
      AND qcr2.DATA_POINT  = :DATA_POINT
      AND qcr2.RESULT_NO   = :RESULT_NO)

2 replies

Forum|alt.badge.img+10
  • Author
  • Sidekick (Customer)
  • November 10, 2025

I wanted COUNT order_no: 

 

SELECT COUNT(q.order_no) 
FROM QMAN_CATEGORICAL_RESULTS q
WHERE q.order_no= :order_no
GROUP BY q.order_no 

 

but this isnt working, in where condition I can add only objkey, but this retrieves wrong values.


Forum|alt.badge.img+8
  • Sidekick (Partner)
  • Answer
  • November 10, 2025

Hi, 

This requirement can be covered with a subquery to fetch the OrderNo connected to the QMAN_CATEGORY_SAMPLE_VALUE record. However can you tell me what is the exact business requirement behind this as what you have written does not make sense to me.

Pierre

FYI : 
SELECT COUNT(qcr1.ORDER_NO)
FROM QMAN_CATEGORICAL_RESULTS qcr1
WHERE qcr1.ORDER_NO = (
    SELECT qcr2.ORDER_NO
    FROM QMAN_CATEGORICAL_RESULTS qcr2
    WHERE qcr2.ANALYSIS_NO = :ANALYSIS_NO
      AND qcr2.DATA_POINT  = :DATA_POINT
      AND qcr2.RESULT_NO   = :RESULT_NO)