ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  SQL Subqueries
Subject:   Will a sub query help with LONG-Data?
Date:   2007-07-30 20:10:08
From:   dgreep
I'm querying an Oracle DB where I want to retrieve totals and a comment field. The comment field is LONG data and causes a "group by" error. Is there a way to create such a query?


SELECT STDRPT_WO_DETAIL.EQ_EQUIP_NO, STDRPT_WO_DETAIL.WORK_ORDER_ID, STDRPT_WO_DETAIL.REAS_REAS_FOR_REPAIR, RSN_MAIN.DESCRIPTION, STDRPT_WO_DETAIL.JOB_TYPE, STDRPT_WO_DETAIL.JOB_STATUS, Sum(STDRPT_WO_DETAIL.XXFLT1202_LINE_TOTAL) AS SumOfXXFLT1202_LINE_TOTAL, STDRPT_WO_DETAIL.COMMENT_AREA AS FirstOfCOMMENT_AREA
FROM STDRPT_WO_DETAIL


INNER JOIN RSN_MAIN ON STDRPT_WO_DETAIL.REAS_REAS_FOR_REPAIR = RSN_MAIN.REAS_REAS_FOR_REPAIR


GROUP BY STDRPT_WO_DETAIL.EQ_EQUIP_NO, STDRPT_WO_DETAIL.WORK_ORDER_ID, STDRPT_WO_DETAIL.REAS_REAS_FOR_REPAIR, RSN_MAIN.DESCRIPTION, STDRPT_WO_DETAIL.JOB_TYPE,
STDRPT_WO_DETAIL.JOB_STATUS


HAVING STDRPT_WO_DETAIL.EQ_EQUIP_NO ="7002064";