Labels

[ALRT] (3) [AR] (2) [BOM] (3) [GL] (2) [GTM] (1) [INV] (18) [MRP] (1) [OM] (27) [PO] (58) [QP] (3) [SYS] (39) [WIP] (4) AGIS (1) OM (1)

Monday, January 24, 2011

[SYS] Given a List of Records (varchar) Returned From a SQL Statement, Which is Ordered First, Which is Ordered Last

Given below SQL,

SELECT
category_concat_segs
FROM apps.mtl_categories_v
WHERE structure_name LIKE 'Purchasing%'
AND disable_date IS NULL
AND category_concat_segs LIKE 'ABC.DEF%'

Return results were,
ABC.DEF1
ABC.DEF2
ABC.DEF3
ABC.DEF4
ABC.DEF5

I want to get only 'ABC.DEF1' & 'ABC.DEF5' from a single SQL statement. These will be used for my Item Category approval rule setup in Approval Group, low range and high range respectively.

Revised SQL below:
SELECT MIN(category_concat_segs), MAX(category_concat_segs)
FROM apps.mtl_categories_v
WHERE structure_name LIKE 'Purchasing%'
AND disable_date IS NULL
AND category_concat_segs LIKE 'ABC.DEF%'

No comments:

Post a Comment