Group and concatenate data

Hello

I need a complex query to retrieve the lag entered in a specific format.

I have following three tables.

TSHT_SHIFT_SCHEDULE

SCHEDULE_ID

From_Date

To_date

SECTION_ID

1

21/09/2011

30/11/2011

16

2

21/09/2011

20/03/2012

21

TSHT_SHIFT_SCHEDULE_DETAILS

SCHEDULE_ID

DAY_ID

SHIFT_ID

EMPLOYEE_ID

1

1

0

61

1

1

1

60

1

1

2

58

1

1

3

66

1

2

0

58

1

2

1

66

1

2

2

60

1

2

3

61

1

3

1

61

1

3

2

60

1

3

2

66

1

3

3

58

1

4

1

58

1

4

2

60

1

4

2

61

1

4

3

66

1

5

1

66

1

5

2

58

1

5

2

60

1

5

3

61

1

6

0

60

1

6

1

61

1

6

2

66

1

6

3

58

1

7

0

66

1

7

1

58

1

7

2

61

1

7

3

60

2

1

0

98

2

1

1

93

2

1

2

100

2

1

3

92

2

2

0

100

2

2

1

92

2

2

2

98

2

2

3

93

2

3

1

93

2

3

2

92

2

3

2

98

2

3

3

100

2

4

1

100

2

4

2

92

2

4

2

93

2

4

3

98

2

5

1

98

2

5

2

92

2

5

2

93

2

5

3

100

2

6

0

93

2

6

1

100

2

6

2

92

2

6

3

98

2

7

0

92

2

7

1

98

2

7

2

100

2

7

3

93

EMPLOYEE_MASTER

EMPLOYEE_ID

BADGE_NO

58

M353

60

M355

61

M356

66

M361

The screen for entering data in my program looks like

UPDATE 12-8

MAJ 8-4

MAJ 4-12

OFF

SUN

M355

M353

M361

M356

LUN

M361

M355

M356

M353

MAR

M356

M361, M355

M353

FRI

M353

M356 M355

M361

THUR

M361

M353, M355

M356

FRI

M356

M361

M353

M355

SAM

M353

M356

M355

M361

Day ID 1,2,3,4,5,6,7 are Sun, Mon, Mar, sea, game, sat, Sam respectively

Shift_ids 0,1,2,3 are off, Maj 1st, 2nd quarter, 3rd quarter respectively.

I want to query the TSHT_SHIFT_SCHEDULE_DETAILS table to retrieve data in the format above

The set must be as follows

Day_id

first

second

third

off

1

M355

M353

M361

M356

2

M361

M355

M356

M353

3

M356

M361, M355

M353

4

M353

M356 M355

M361

5

M361

M353, M355

M356

6

M356

M361

M353

M355

7

M353

M356

M355

M361

Is this possible?

Help, please...

2730134 wrote:

Hi Chris,

Please note that TUESDAY in shift2(8-4) there are two employees M361, M355

But with the request that you have posted, I get only M355.

Is it possible to recover several employees concatenated with comma?

Thank you

OK, did not notice that:

Select

DAY_ID

, rtrim (xmlagg (xmlelement (e, decode (SHIFT_ID, 1, BADGE_NO |)))) (') BADGE_NO).extract('//text order () '), ',') 'first.

, rtrim (xmlagg (xmlelement (e, decode (SHIFT_ID, 2, BADGE_NO |)))) (') BADGE_NO).extract('//text order () '), ',') 'second '.

, rtrim (xmlagg (xmlelement (e, decode (SHIFT_ID, 3, BADGE_NO |)))) (') BADGE_NO).extract('//text order () '), ',') 'third '.

, rtrim (xmlagg (xmlelement (e, decode (SHIFT_ID, 0, BADGE_NO |)))) (') BADGE_NO).extract('//text order () '), ',') 'off '.

of TSHT_SHIFT_SCHEDULE_DETAILS d

E EMPLOYEE_MASTER

where

e.EMPLOYEE_ID = d.EMPLOYEE_ID

and SCHEDULE_ID = 1

Group

SCHEDULE_ID

DAY_ID

order of day_id

DAY_ID, first, secondly, thirdly, off

'1', 'M355', 'M353', 'M361', 'M356.

'2', 'M361', 'M355', 'M356', 'M353.

"3', 'M356", "M355, M361,"M353. "

"4', 'M353", "M355, M356"M361. "

"5', 'M361", "M353, M355"M356. "

'6', 'M356', 'M361', 'M353', 'M355.

'7', 'M353', 'M356', 'M355', 'M361.

Tags: Database

Similar Questions

  • Group and summarize data

    Hello
    I accumulate (modified an existing) report to have an overview on all virtual machines in our environment. Now I've grouped by host chargeback groups. So I have a column in the report showing the host since the billing module group internal.
    What I need now and can not find a solution is to have a collection of virtual machines on the host group with a summary below each group row, by counting the number of processors, memory, disk space etc used.
    Anyone out there who can help me?
    Best regards
    hEINER

    Hi hEINER,.
    I don't think that Foglight has a feature that is exactly like what you are looking for. The service constructor is probably the closest thing you can get to what you want.
    Can take you a look in the service constructor to see if that can get your desired function?
    Dashboards: Services | Function generator
    Thank you
    -dave

  • Grouping and sorting data based on the parameter

    Hello

    I need to display the total total Sub for cost element that is based on the setting in Excel format

    If value = 1 then (subtotal of manufacturing) and sorting by Date of receipt, organization, production, item Code

    If value = 2, then (subtotal per organization) and sort by organization, serial number

    and at the end of the report should show total full

    is it possible in excel using the output of the xml below, please guide me if I need to change the way to get the XML output or can be achieved using this.

    Please find the XML, thanks in advance

    <? XML version = "1.0"? >
    <! - generated by the Oracle version 6.0.8.27.0 reports - >
    < ASWRECDTREP >
    < LIST_G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 90699100802262 < / Serial_number >
    < ITEM_CODE > OM906LA.007 < / ITEM_CODE >
    < DESCRIPTION > MERCEDES SERIES 900 OFF-Highway ENGINE 205 KW 0852 < / DESCRIPTION >
    SEA < MANUFACTURER > < / MANUFACTURER >
    INDL < APPLICATION > < / APPLICATION >
    < ITEM_COST > 15009.09 < / ITEM_COST >
    < MATERIAL_COST > 685.25 < / MATERIAL_COST >
    < > 1001395 PO_NUMBER < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 22 May 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    EUR < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 7431.3 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
    < Serial_number > 90699100802285 < / Serial_number >
    < ITEM_CODE > OM906LA.007 < / ITEM_CODE >
    < DESCRIPTION > MERCEDES SERIES 900 OFF-Highway ENGINE 205 KW 0852 < / DESCRIPTION >
    SEA < MANUFACTURER > < / MANUFACTURER >
    INDL < APPLICATION > < / APPLICATION >
    < ITEM_COST > 15009.09 < / ITEM_COST >
    < MATERIAL_COST > 685.25 < / MATERIAL_COST >
    < > 1001395 PO_NUMBER < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 22 May 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    EUR < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 7431.3 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 30 < / ORGANIZATION_CODE >
    Melbourne < ORGANISATION_NAME > < / ORGANISATION_NAME >
    < Serial_number > 6520107896 < / Serial_number >
    < ITEM_CODE > 3500.010 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E018179 < / DESCRIPTION >
    ATD < MANUFACTURER > < / MANUFACTURER >
    ONHY < APPLICATION > < / APPLICATION >
    < ITEM_COST > 11126.11 < / ITEM_COST >
    < MATERIAL_COST > 664.23 < / MATERIAL_COST >
    < PO_NUMBER > 971515 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 14 April 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 8063.3 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 30 < / ORGANIZATION_CODE >
    Melbourne < ORGANISATION_NAME > < / ORGANISATION_NAME >
    < Serial_number > 6510869062 < / Serial_number >
    < ITEM_CODE > 3200.010 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E017944 < / DESCRIPTION >
    ATD < MANUFACTURER > < / MANUFACTURER >
    ONHY < APPLICATION > < / APPLICATION >
    < ITEM_COST > 11853.57 < / ITEM_COST >
    < MATERIAL_COST > 707.66 < / MATERIAL_COST >
    < PO_NUMBER > 982120 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 12 May 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 8251.6 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 40 < / ORGANIZATION_CODE >
    Brisbane < ORGANISATION_NAME > < / ORGANISATION_NAME >
    G6003 D6002 < Serial_number > < / Serial_number >
    SERIES.002 < > 520 ITEM_CODE < / ITEM_CODE >
    < DESCRIPTION > KONRAD 520 SERIES MARINE STERN DRIVE < / DESCRIPTION >
    OTH < MANUFACTURER > < / MANUFACTURER >
    HUSBAND < APPLICATION > < / APPLICATION >
    < ITEM_COST > 9296.95 < / ITEM_COST >
    < MATERIAL_COST > 482.91 < / MATERIAL_COST >
    < PO_NUMBER > 1009062 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 24 June 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 6939.29 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 40 < / ORGANIZATION_CODE >
    Brisbane < ORGANISATION_NAME > < / ORGANISATION_NAME >
    ABC123 < Serial_number > < / Serial_number >
    < ITEM_CODE > GM20541 - KP1.001 < / ITEM_CODE >
    GENERATOR KOHLER < DESCRIPTION > < / DESCRIPTION >
    KOH < MANUFACTURER > < / MANUFACTURER >
    Collage < APPLICATION > < / APPLICATION >
    < > 756.83 ITEM_COST < / ITEM_COST >
    < MATERIAL_COST >.78 < / MATERIAL_COST >
    < PO_NUMBER > 1015156 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 14 October 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 20 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 40 < / ORGANIZATION_CODE >
    Brisbane < ORGANISATION_NAME > < / ORGANISATION_NAME >
    ABC124 < Serial_number > < / Serial_number >
    < ITEM_CODE > GM20541 - KP1.001 < / ITEM_CODE >
    GENERATOR KOHLER < DESCRIPTION > < / DESCRIPTION >
    KOH < MANUFACTURER > < / MANUFACTURER >
    Collage < APPLICATION > < / APPLICATION >
    < > 756.83 ITEM_COST < / ITEM_COST >
    < MATERIAL_COST >.78 < / MATERIAL_COST >
    < PO_NUMBER > 1015156 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 14 October 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    AUD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 20 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
    06R1017763 < Serial_number > < / Serial_number >
    < ITEM_CODE > 6062HK30.005 < / ITEM_CODE >
    < DESCRIPTION > DETROIT SERIES 60 ENGINE SAILOR 615 KW 2949322 < / DESCRIPTION >
    DDM < MANUFACTURER > < / MANUFACTURER >
    HUSBAND < APPLICATION > < / APPLICATION >
    < ITEM_COST > 99125.34 < / ITEM_COST >
    < MATERIAL_COST > 2028.31 < / MATERIAL_COST >
    < PO_NUMBER > 883339 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 5 March 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 63768 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
    < Serial_number > 6310935001 < / Serial_number >
    < ITEM_CODE > 2500.003 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
    ATD < MANUFACTURER > < / MANUFACTURER >
    ONHY < APPLICATION > < / APPLICATION >
    < ITEM_COST > 4855.33 < / ITEM_COST >
    < MATERIAL_COST > 306.39 < / MATERIAL_COST >
    < PO_NUMBER > 1000221 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 1 June 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
    < Serial_number > 6310935002 < / Serial_number >
    < ITEM_CODE > 2500.003 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
    ATD < MANUFACTURER > < / MANUFACTURER >
    ONHY < APPLICATION > < / APPLICATION >
    < ITEM_COST > 4855.33 < / ITEM_COST >
    < MATERIAL_COST > 306.39 < / MATERIAL_COST >
    < PO_NUMBER > 1000221 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 1 June 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
    < Serial_number > 6310935003 < / Serial_number >
    < ITEM_CODE > 2500.003 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
    ATD < MANUFACTURER > < / MANUFACTURER >
    ONHY < APPLICATION > < / APPLICATION >
    < ITEM_COST > 4855.33 < / ITEM_COST >
    < MATERIAL_COST > 306.39 < / MATERIAL_COST >
    < PO_NUMBER > 1000221 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 1 June 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
    < Serial_number > 6510876301 < / Serial_number >
    < ITEM_CODE > T350R.004 < / ITEM_CODE >
    < DESCRIPTION > ALLISON TORQMATIC WE HWY TRANSMISSION < / DESCRIPTION >
    ATD < MANUFACTURER > < / MANUFACTURER >
    ONHY < APPLICATION > < / APPLICATION >
    < ITEM_COST > 9465.69 < / ITEM_COST >
    < MATERIAL_COST > 597.33 < / MATERIAL_COST >
    < PO_NUMBER > 1005777 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 6936.3 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
    < Serial_number > 6510876302 < / Serial_number >
    < ITEM_CODE > T350R.004 < / ITEM_CODE >
    < DESCRIPTION > ALLISON TORQMATIC WE HWY TRANSMISSION < / DESCRIPTION >
    ATD < MANUFACTURER > < / MANUFACTURER >
    ONHY < APPLICATION > < / APPLICATION >
    < ITEM_COST > 9465.69 < / ITEM_COST >
    < MATERIAL_COST > 597.33 < / MATERIAL_COST >
    < PO_NUMBER > 1005777 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 6936.3 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
    < Serial_number > 6510876303 < / Serial_number >
    < ITEM_CODE > T375R.002 < / ITEM_CODE >
    < DESCRIPTION > ALLISON TORQMATIC WE HWY TRANSMISSION < / DESCRIPTION >
    ATD < MANUFACTURER > < / MANUFACTURER >
    ONHY < APPLICATION > < / APPLICATION >
    < ITEM_COST > 10224.19 < / ITEM_COST >
    < MATERIAL_COST > 645.19 < / MATERIAL_COST >
    < PO_NUMBER > 1005777 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 7433.3 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
    < Serial_number > 6310940354 < / Serial_number >
    < ITEM_CODE > 2500.003 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
    ATD < MANUFACTURER > < / MANUFACTURER >
    ONHY < APPLICATION > < / APPLICATION >
    < ITEM_COST > 4855.33 < / ITEM_COST >
    < MATERIAL_COST > 306.39 < / MATERIAL_COST >
    < PO_NUMBER > 1005777 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
    < Serial_number > 6310940355 < / Serial_number >
    < ITEM_CODE > 2500.003 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
    ATD < MANUFACTURER > < / MANUFACTURER >
    ONHY < APPLICATION > < / APPLICATION >
    < ITEM_COST > 4855.33 < / ITEM_COST >
    < MATERIAL_COST > 306.39 < / MATERIAL_COST >
    < PO_NUMBER > 1005777 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
    < Serial_number > 6310940356 < / Serial_number >
    < ITEM_CODE > 2500.003 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
    ATD < MANUFACTURER > < / MANUFACTURER >
    ONHY < APPLICATION > < / APPLICATION >
    < ITEM_COST > 4855.33 < / ITEM_COST >
    < MATERIAL_COST > 306.39 < / MATERIAL_COST >
    < PO_NUMBER > 1005777 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
    < Serial_number > 6310940357 < / Serial_number >
    < ITEM_CODE > 2500.003 < / ITEM_CODE >
    < DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
    ATD < MANUFACTURER > < / MANUFACTURER >
    ONHY < APPLICATION > < / APPLICATION >
    < ITEM_COST > 4855.33 < / ITEM_COST >
    < MATERIAL_COST > 306.39 < / MATERIAL_COST >
    < PO_NUMBER > 1005777 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < G_ASW_REC_DATE >
    < ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
    < ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
    < Serial_number > 5272003543 < / Serial_number >
    < ITEM_CODE > T1637K33.002 < / ITEM_CODE >
    < DESCRIPTION > DETROIT SERIES 4000 ENGINES INDUSTRIAL 1865 KW 2456291 < / DESCRIPTION >
    DDM < MANUFACTURER > < / MANUFACTURER >
    MNIG < APPLICATION > < / APPLICATION >
    < ITEM_COST > 420083.16 < / ITEM_COST >
    < MATERIAL_COST > 3785.85 < / MATERIAL_COST >
    < PO_NUMBER > 921170 < / PO_NUMBER >
    < TRANSACTION_RECEIPT_DATE > 30 June 09 < / TRANSACTION_RECEIPT_DATE >
    < VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
    USD < CURRENCY_CODE > < / CURRENCY_CODE >
    < PO_UNIT_PRICE > 301549 < / PO_UNIT_PRICE >
    < / G_ASW_REC_DATE >
    < / LIST_G_ASW_REC_DATE >
    < / ASWRECDTREP >


    Best regards
    Mahi

    http://winrichman.blogspot.com/2009/10/subtemplating.html

    There you go.

  • SQL grouping and summing impossible?

    I want to create a sql query to summarize some data, but I'm starting to think that it is impossible with sql only. The data I have is of the following form:
    TRAN_DT     TRAN_RS     DEBT     CRED
    10-Jan     701     100     0
    20-Jan     701     150     0
    21-Jan     701     250     0
    22-Jan     705     0     500
    23-Jan     571     100     0
    24-Jan     571     50     0
    25-Jan     701     50     0
    26-Jan     701     20     0
    27-Jan     705     0     300
    The data are classified by TRAN_DT and by TRAN_RS. THA grouping and summing data based on tran_rs, but only when it changes. If in the table above, I don't want to see all the first 3 records but only one value DEBT the sum of these 3 i.e. 100 + 150 + 250 = 500. If the table above after grouping would be similar to that below:
    TRAN_DT     TRAN_RS     DEBT     CRED
    21-Jan     701     500     0
    22-Jan     705     0     500
    24-Jan     571     150     0
    26-Jan     701     70     0
    27-Jan     705     0     300
    The TRAN_DT is the last value of the record sum. I undestand that the tran_dt are not selectable. What I've tried so far is the following query:
    select tran_dt,
             tran_rs,
             sum(debt)over(partition by tran_rs order by tran_dt rows unbounded preceding),
             sum(cred)over(partition by tran_rs order by tran_dt rows unbounded preceding) from that_table
    Is it still possible with only sql, any thoughts?

    The report that I am creating in BI Publisher.Maybe it is possible to group the data in the model and my question here?

    The Re: tutorial method Tabibitosan by Aketi Jyuuzou me would be very useful here:

    with sample_data as (select to_date('10/01/2012', 'dd/mm/yyyy') tran_dt, 701 tran_rs, 100 debt, 0 cred from dual union all
                         select to_date('20/01/2012', 'dd/mm/yyyy') tran_dt, 701 tran_rs, 150 debt, 0 cred from dual union all
                         select to_date('21/01/2012', 'dd/mm/yyyy') tran_dt, 701 tran_rs, 250 debt, 0 cred from dual union all
                         select to_date('22/01/2012', 'dd/mm/yyyy') tran_dt, 705 tran_rs, 0 debt, 500 cred from dual union all
                         select to_date('23/01/2012', 'dd/mm/yyyy') tran_dt, 571 tran_rs, 100 debt, 0 cred from dual union all
                         select to_date('24/01/2012', 'dd/mm/yyyy') tran_dt, 571 tran_rs, 50 debt, 0 cred from dual union all
                         select to_date('25/01/2012', 'dd/mm/yyyy') tran_dt, 701 tran_rs, 50 debt, 0 cred from dual union all
                         select to_date('26/01/2012', 'dd/mm/yyyy') tran_dt, 701 tran_rs, 20 debt, 0 cred from dual union all
                         select to_date('27/01/2012', 'dd/mm/yyyy') tran_dt, 705 tran_rs, 0 debt, 300 cred from dual),
         tabibitosan as (select tran_dt,
                                tran_rs,
                                debt,
                                cred,
                                dense_rank() over (order by tran_dt, tran_rs, rownum)
                                  - dense_rank() over (partition by tran_rs order by tran_dt, rownum) grp
                         from   sample_data)
    select max(tran_dt),
           tran_rs,
           sum(debt) debt,
           sum(cred) cred
    from   tabibitosan
    group by tran_rs,
             grp
    order by 1, 2;
    
    TRAN_DT       TRAN_RS       DEBT       CRED
    ---------- ---------- ---------- ----------
    21/01/2012        701        500          0
    22/01/2012        705          0        500
    24/01/2012        571        150          0
    26/01/2012        701         70          0
    27/01/2012        705          0        300
    

    ETA: I added the rownum in analytical functions to take account of the "encounters" where a tran_rs has multiple entries for the same tran_dt. If you have some other unique key to use (for example, the primary key of the table) then I would use instead.

    Published by: Boneist on February 17, 2012 11:41

  • Added properties (Group and channel) are not a numeric data type.

    I use a use to add two groups and channel custom properties. The properties are text and digital, double and whole.

    When I create a request in the browser, I selects the custom using the drop-down list property, but has only the drop operator "=" or "<>". "" The property is displayed in the data portal is a number of float. I had this problem when I was adding properties custom by using a script. I then tried "Navigatorinstallation / my Index DataFinder/Reset/Reset", then repopulated my search box, using the use on my raw data files. At this point, all the properties of my have only the "=" or "<>" choice of operator in the query.

    It seems that my properties are digital in the data portal, but the the query string of the browser.

    Thanks in advance,

    Hi Bill,

    You don't have to delete the files.  Choose the NAVIGATOR menu "settings > My DataFinder > reset... '. "can clilck on the UPPER part of the two buttons, one called"reset the index.  Which will remove all records in database and re-index all of your data files.  If you one of these properties have already optimized, set their State not optimized before resetting the index, otherwise the optimized property data types will persist.

    If this does not help, then the problem could be in the use that you use.

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • How to remove messages in Exchange 2010 by dates. in a group and exclude the Contacts, record retention and calendar

    How to remove messages in Exchange 2010 by dates.  in a group and exclude the Contacts, record retention and calendar.

    I'm deleting emails from users in a group called MX_Purge file. I need to delete the emails date xx/xx/xxxx to xx/xx/xxxx.

    I also need to exclude the excluded the following records 'calendars' folders 'Contacts' and 'Retention '.

    The server people hang around more in the TechNet forums, if you ask, you will get a much better response:

    http://social.technet.Microsoft.com/forums/en-us/Exchange2010/threads

  • Consecutive date grouping and find the largest number of consecutive group

    Hi all

    I have given dates and I want to find the largest number of consecutive dates

    WIN_DATE_DATA

    2015-09-22

    2015-09-23

    2015-09-27

    2015-09-28

    2015-09-29

    2015-09-30

    2015-10-1


    In this example, there are 2 group of consecutive dates

    Group 1

    2015-09-22

    2015-09-23

    Group 2

    2015-09-27

    2015-09-28

    2015-09-29

    2015-09-30

    2015-10-1


    The OUTPUT should 5 which is the largest grouping of consecutive number.


    Thanks in advance for the help!




    Please take a look at the Community document: 101 PL/SQL: grouping sequence ranges (method Tabibitosan)

    will allow you to do.

  • data tables store information of groups and users?

    Hi all

    I want to export all the information of users and groups on the Administration of BI tool. only I can copy them one by one. are there other methods?
    who knows what data tables store information of groups and users?

    Thank you
    Dan.

    Hi dan,.

    As you can not access the link which is very informative. Never I've implemented it but john's suggestion, it should work

    Courtesy John: -.

    OBIEE get all RPD users
    I had to get all the users a repository very large because they where to implement a new security model. Wrote a small script to make life easier:

    ' Read_Users.VBS
    "John Minkjan
    "http:// http://www.obiee101.blogspot.com/
    ' Get all the users from a repository
    1: do an export the PRD UDML using nqgenudml.exe
    2: change the location/name of file in this script
    3: run the script in the cscript Read_Users.VBS command line > users.txt
    Set objFSO = CreateObject ("Scripting.FileSystemObject")

    "this point your EXPORTSet UDML
    objFile = objFSO.OpenTextFile ("E:\names.txt", ForReading)

    Const ForReading = 1
    Dim arrFileLines()
    Dim strRLinedim strTemp1dim strTemp2

    I have = 0

    Up to objFile.AtEndOfStream
    strRline = objFile.ReadLine
    If left(strRline,12) = "USER to DECLARE" then
    ReDim Preserve arrFileLines (i)
    arrFileLines (i) = strRline
    i = i + 1
    end if
    Loop

    objFile.Close
    "Then you can iterate over it like that"
    For each strLine in arrFileLines
    strTemp1 = MID (strLine, 15: 50)
    IF instr (strline,"}" ") > 0 THEN
    strTemp2 = MID (strLine, instr(strline,"{") + 1, (instr(strline,"}") - (instr(strline,"{") + 1))) ELSE strTemp2 = «»
    END IF
    WScript.Echo MID (strTemp1, 1, instr(strTemp1, """)-1) &"; '& strtemp2 '.
    Next

    OBIEE get all users and roles of RPD
    In this http://obiee101.blogspot.com/2009/06/obiee-get-all-users-from-rpd.html post I showed you how to get users to the RPD. That take as a point of departure it is a small step to get users and roles they have and put the export in a XLS:

    ' Read_Usergroups.VBS 'John Minkjan' http: / / http://www.obiee101.blogspot.com/
    ' Get all the users from a repository
    1: do an export the PRD UDML using nqgenudml.exe
    2: change the location/name of file in this script
    3: run the script in the cscript Read_Usergroups.VBS command line > users.txt
    4: put the export in a pivot table XLS

    Set objFSO = CreateObject ("Scripting.FileSystemObject")
    "this point your EXPORT UDML
    Set objFile = objFSO.OpenTextFile ("E:\usergroup.txt", ForReading)
    Const ForReading = 1
    Dim arrFileLines()
    Dim strRLine
    Dim strTemp1
    Dim strTemp2
    Dim strTemp3
    Dim intRoles
    intRoles = 0
    I have = 0
    WScript.Echo "username; FULL_NAME; ROLE; COUNT. "
    Up to objFile.AtEndOfStream
    strRline = objFile.ReadLine
    If left(strRline,12) = arrFileLines (i) 'DECLARE the USER', then Redim Preserve
    strTemp1 = MID (strRLine, 15, 50)
    strTemp1 = MID (strTemp1, 1, instr(strTemp1, """)-1)
    IF instr (strRline,"}" ") > 0 THEN
    strTemp2 = MID (strRLine, instr(strRline,"{") + 1, (instr(strRline,"}") - (instr(strRline,"{") + 1)))
    ON THE OTHER
    strTemp2 = «»
    END IF
    arrFileLines (i) = strTemp1 &"; "& strtemp2
    intRoles = 1
    i = i + 1
    end if
    If intRoles > = 1 then
    If instr (strRline, "has ROLES (" ") > 0 then
    intRoles = 2
    end if
    If intRoles = 2 and instr (strRline, "a of the ROLES (" ") = 0 then
    strTemp3 = MID (strRline, instr (strRline, "" "") + 1.50)
    strTemp3 = MID (strTemp3, 1, instr(strTemp3, """)-1)
    WScript.Echo arrFileLines(i-1) &"; "& strTemp3 &"; 1 "
    end if
    If intRoles = 2 and instr (strRline)",") > 0 then intRoles = 0
    end if
    end ifLoop
    objFile.Close

    UPDATE POST
    Is your on the right track, work these steps you will find glory... I force try it or needed me.

    hope helped you

    Kind regards
    Murielle.

    Published by: Kranthi.K on June 1st, 2011 02:28

  • Group and ungroup without all the data to a single layer?

    Hello!  When I combine several functions (usually for purposes of alignment), separating them and then throw all the objects on a layer.  It's pretty frustrating; Anyone know a work around?

    You need to revise your workflow. When you group things they belong on the layer of the object higher in the Group and when you release that's where they stay. You could try to save a selection instead of a group for purposes of alignment by watching. A selection can have objects on multiple layers.

  • Group incoming Boolean data in groups of two

    Hello

    I ve 4 digital bits data (boolean) inheriting the DAQmx permanently and I need aggregate data in groups of two, concatenate the elements in the Group and convert it to ascii charaters and view. I m not getting much idea as to what to do, to implement this.

    That's what to do

    Data flow: 4,8,6, F, 2, 0, 3, 5... etc.

    data groups: 48, 6F, 20 etc.

    Need help with the grouping of items. I don't think that store in an array is gona help me, coz I have to display the ascii charater as soon the data in his group arrives. That is to say if 48 is 'H', I need to display 'H' as soon 4 8 arrives, grouping them, similarly to 6F to be converted into 'o' and so on.

    Thank you

    Hi Walker_is_here,

    Check out the attached vi. It can help you.

    Kind regards
    NitZ

    (Bravo to give good answers, mark it as a Solution If your problem is resolved)

  • Date of creation and the Date of importation

    When you import photos or video in the Photos to a folder, the application uses the date of importation of integration rather than the original creation date.  The result is that imports are all presented together under "Today."  Many photos and video taken on different dates, so I would only they listed according to date of creation rather than be grouped under the date of importation.  I went 'View' and checked "date of creation".  Photos don't work with "SORT" because it is always grey.  Any help would be greatly appreciated!

    If you look in the window of Photos photos and videos are sorted by date with the oldest items at the top.  This sort order cannot be change.

    In the pictures window, the elements are sorted by the date imported into the library with the oldest at the top.  The sort order cannot be changed here either.

    So, you can use a smart album to include all your photos in the library and then sort them one of these ways:

    The smart album could be created to this criterion:

    that would include all the photos in the library.  Now you can sort them as you like.  Just make sure that the date is early enough to catch all the photos in the library.

    Moments in Photos are new events, i.e. groups of photos sorted by date of catch.

    When the iPhoto library has been migrated first to the pictures there is a folder created in the box titled iPhoto events and all migrated iPhoto events (which are now Moments) are represented by an album in this folder. Use the Command + Option + S key combination to open the sidebar if it is not already open.

    NOTE: it has been reported by several users that if the albums of the event are moved in the iPhoto Library folder in the sidebar, they disappear.  It is not widespread, but several users have reported this problem.  Therefore, if you want to if ensure that you keep these event albums do not transfer out of the iPhoto events folder.

    Is there a way to simulate events in pictures.

    When new photos are imported in the library of Photos, go to the smart album last import , select all the photos and use the file menu option ➙ New Album or use the key combination command + N.  Call it what you want.  It appears just above the folder to iPhoto events where you can drag it into the events in iPhoto folder

    When you click on the folder to iPhoto events, you will get a window simulated of iPhoto events.

    Albums and smart albums can be sorted by title, by Date, with the oldest first and by Date with the most recent first.

    Tell Apple what missing features you want restored or new features added in Photos Photo-Applefeedback.

  • Close command of the groups in the data portal

    Hello

    can I use a command in a script to close all groups in the data portal (same as pressing "/" on the num pad).

    Thank you

    Gabriel

    Hello Gabriel,

    You can use

    Portal.Structure.Collapse (Data.Root)

    Tiara supports DATA and PORTAL API since version 11.

    Greetings

    Walter

  • Need help with Oracle SQL merge records according to date and term dates

    Hi all

    I need help to find this little challenge.

    I have groups and flags and effective dashboards and dates of term against these indicators according to the following example:

    GroupName Flag_A Flag_B Eff_date Term_date
    Group_ATHERETHERE2011010199991231
    Group_ANN2010010120101231
    Group_ANN2009010120091231
    Group_ANN2006010120081231
    Group_ANTHERE2004010120051231
    Group_ATHERETHERE2003010120031231
    Group_BNTHERE2004010199991231
    Group_BNTHERE2003010120031231

    As you can see, group_A had the same combination of (N, N) flag for three successive periods. I want to merge all the time periods with the same indicators in one. Where entry into force will be the most early (underlined) time period and end date will be later (underlined)

    So the final result should look like this:

    GroupName Flag_A Flag_B Eff_date Term_date
    Group_ATHERETHERE2011010199991231
    Group_ANN2006010120101231
    Group_ANTHERE2004010120051231
    Group_ATHERETHERE2003010120031231
    Group_BNTHERE2003010199991231

    Thanks for your help

    Here's the DDL script

    drop table TMP_group_test;

    create table TMP_group_test (groupname varchar2 (8))

    , flag_a varchar2 (1)

    , flag_b varchar2 (1)

    , eff_date varchar2 (8)

    , term_date varchar2 (8)

    );

    insert into TMP_group_test values ('Group_A', 'Y', 'Y', ' 20110101 ', ' 99991231');

    insert into TMP_group_test values ('Group_A', 'n', ' n ', ' 20100101 ', ' 20101231');

    insert into TMP_group_test values ('Group_A', 'n', ' n ', ' 20090101 ', ' 20091231');

    insert into TMP_group_test values ('Group_A', 'n', ' n ', ' 20060101 ', ' 20081231');

    insert into TMP_group_test values ('Group_A', 'n', 'Y', ' 20040101 ', ' 20051231');

    insert into TMP_group_test values ('Group_A', 'Y', 'Y', ' 20030101 ', ' 20031231');

    insert into TMP_group_test values ('Group_B', 'n', 'Y', ' 20040101 ', ' 99991231');

    insert into TMP_group_test values ('Group_B', 'n', 'Y', ' 20030101 ', ' 20031231');

    commit;

    Post edited by: user13040446

    It is the closest, I went to the solution


    I create two rows;

    Rnk1: partition by group name, order of eff_date / / desc: this grade will sort the records of the most recent and handed to zero for each group\

    Rnk2: (dense) partition by group name, flag_A, flagb: this grade for each combination of group\flag gives a number so that they are classified as "families".

    Then I use the function analytic min

    Min (eff_date) more (partition of GroupName, rnk2): the idea is that, for each Member of the same family, the new date is the min of the family (and the max for the date of the term), at the end I just need separate so that the duplicates are gone

    Now the problem. As you can see from the query below, records of 1 and 6 (as identified by rownum) are identified in the same family, because they have the same combination of flag, but they are not successive, so everyone must keep its own date of entry into force.

    If only I can make the distinction between these two that would solve my problem


    Query:


    Select rowNum,GroupName, flag_a, flag_b, eff_date, term_date, rnk1, rnk2

    , min (eff_date) more than (partition by GroupName rnk2( ) min_eff

    Of

    (

    Select rowNum,

    GroupName , flag_a , flag_b , eff_date , term_date

    rank() more than (partition by GroupName stopped by eff_date desc) rnk1

    DENSE_RANK() more than (partition by GroupName order by flag_A flag_B ( ) rnk2

    de dsreports . tmp_group_test

    ) order by rowNum

    Hello

    user13040446 wrote:

    Hi KSI.

    Thanks for your comments, you were able to distinguish between these lines highlight, but lost lines 2,3,4 which are supposed to have the same date min = 20060101.

    Please see the table wanted to see the final result I want to reach

    Thanks again

    This first answer is basically correct, but in the main query, you want to use the function MIN, not the analytical function aggregation and GROUP BY columns with common values, like this:

    WITH got_output_group AS

    (

    SELECT GroupName, flag_a, flag_b, eff_date, term_date

    ROW_NUMBER () OVER (PARTITION BY GroupName

    ORDER BY eff_date

    )

    -ROW_NUMBER () OVER (PARTITION BY GroupName, flag_a, flag_b)

    ORDER BY eff_date

    ) AS output_group

    OF tmp_group_test

    )

    SELECT GroupName, flag_a, flag_b

    MIN (eff_date) AS eff_date

    MAX (term_date) AS term_date

    OF got_output_group

    GROUP BY GroupName, flag_a, flag_b

    output_group

    ORDER BY GroupName

    eff_date DESC

    ;

    The result I get is

    GROUP_NA F F EFF_DATE TERM_DAT

    -------- - - -------- --------

    Group_A Y 20110101 99991231 Y

    N Group_A 20101231 20060101 N

    Group_A N 20051231 20040101 Y

    Group_A Y Y 20031231-20030101

    Group_B N Y 99991231 20030101

    which is what you asked for.

  • unexpected results of the Group and the merger of processor

    Hi team,

    I use a processor of group and the merger in a process that includes "Store-num" and the "Cust-num" and mergers based on the most common value.

    I have few records store-Num = 42 and a few records store-num = 426. But for the same "Cust-num" for these two stores, store-num ' 426' we replace "42"

    My point is that these documents should not have grouped at all.

    No idea why this happen?

    Kind regards

    Ravi

    Yes, that's correct. Dates will be converted to a string representation of the date.

  • Group by with date range.

    Hello

    I'm looking for an efficient use of the group however the date range.

    I have a table of transaction as below.

    Date customer_no amount_paid

    ---------------------------------------------------------------

    1st December 13 001 500

    2 December 13 001 360

    9 December 13 001 200

    2 November 13 001 360

    9 November 13 001 200

    2 November 13 001 360

    9 October 13 001 200

    2 October 13 001 360

    9 October 13 001 200

    02 sep-13 001 360

    200 001 13 - Sep - 09

    ............... etc.

    I would like to see sum (amount_paid) by past varies from 1 to 30 days 31-60 days, 61 to 90 days.

    Here are the results expected.

    Amount_paid duration of customer

    --------------------------------------------------------------

    001 1 - 30 980

    001-60 450 31

    001 1200 61 - 90

    002 1 - 30 300

    002 31-60 490

    002 61-90 320

    003 1 - 30 450

    ......................etc.

    I group by customer only the date range (1-30, 31-60, 61 - 90.etc).

    Can someone make me a request for it.

    Thank you...

    Hedde.

    Select customer_no,

    case

    When trunc (sysdate) - trunc (dt)< 31="" then="">

    When trunc (sysdate) - trunc (dt)< 61="" then="">

    another 61-90 '

    the end time,

    Sum (amount_paid) amount_paid

    from your_table

    where dt between sysdate - dt between 0 and 90

    Customer_no group,

    case

    When trunc (sysdate) - trunc (dt)< 31="" then="">

    When trunc (sysdate) - trunc (dt)< 61="" then="">

    another 61-90 '

    end

    /

    SY.

Maybe you are looking for