greengo204
Technical User
Informix DB
i was wondering if someone could help me writing a sub query using just a case statement (if possible) so far i got:
I was wondering if its possible to have just a case statement in a subquery and if anyone could suggest where i have gone wrong in the above code.
Im very new at writing SQL so please be gentle...
Cheers
i was wondering if someone could help me writing a sub query using just a case statement (if possible) so far i got:
Code:
(
SELECT
CASE
WHEN IS NULL (sum (po_order_line.order_line_amnt))
THEN 'ZERO'
WHEN sum (po_order_line.order_line_amnt) > 0 AND sum (po_order_line.order_line_amnt) < 1000
THEN 'LOW'
WHEN sum (po_order_line.order_line_amnt) >= 1000 AND sum (po_order_line.order_line_amnt) < 2000
THEN 'MEDIUM'
WHEN sum (po_order_line.order_line_amnt) >= 2000
THEN 'LARGE'
ELSE
sum (po_order_line.order_line_amnt)
END,
FROM
popes:popesdba.po_order po_order,
popes:popesdba.po_order_line po_order_line,
popes:popesdba.po_invc po_invc
WHERE
po_fi_cnrct.cnrct_id = po_order.fi_cnrct_id AND
po_order.order_id = po_order_line.order_id AND
po_order.order_stat_cd = po_order_line.order_stat_cd AND
po_order.invc_id = po_invc.invc_id
)
I was wondering if its possible to have just a case statement in a subquery and if anyone could suggest where i have gone wrong in the above code.
Im very new at writing SQL so please be gentle...
Cheers