Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

creating flag if value is minimum

hi everybody,

I have following table:

OrderId
OrderDateSessionDate
OrderSessionDate-Diff
AA2011-07-15 12:07:002011-07-15 12:00:0000:07
BB2011-11-06 21:12:002011-11-06 21:00:0000:12
BB2011-11-06 21:12:002011-11-06 21:06:0000:06
BB2011-11-06 21:12:002011-11-06 21:20:00-00:08
CC2011-03-18 23:04:002011-03-18 23:00:0000:04
CC2011-03-18 23:04:002011-03-18 23:10:00-00:06
DD2011-02-08 14:08:002011-02-08 14:07:0000:01

I need a table with a flag column that identified the row with minimum value of column 'OrderSessionDate-Diff' for each order.

My result should look like this:

OrderIdOrderDateSessionDateOrderSessionDate-DiffFlag
AA2011-07-15 12:07:002011-07-15 12:00:0000:07Yes
BB2011-11-06 21:12:002011-11-06 21:00:0000:12No
BB2011-11-06 21:12:002011-11-06 21:06:0000:06Yes
BB2011-11-06 21:12:002011-11-06 21:20:00-00:08No
CC2011-03-18 23:04:002011-03-18 23:00:0000:04Yes
CC2011-03-18 23:04:002011-03-18 23:10:00-00:06No
DD2011-02-08 14:08:002011-02-08 14:07:0000:01Yes

Please help, THX!

1 Reply
Not applicable
Author

Hi,

See the attached qvw/

Hope it help.