Getting Started with Adobe After Effects - Part 6: Motion Blur
Ask
Ask questions, discuss or help others by answering
Related Posts · View All
SQL Server 146
TSQL 76
SSRS 71
SSIS 68
XML 57

Top Categories · View All
SQL Server 146
TSQL 76
SSRS 71
SSIS 68
XML 57

Serial number generation in T-SQL

Jan 16 2014 12:00AM by imrajesh   

I need output for the below sample. the trip number has to be generated for each carrier, truck, trip eligibility combination. but if the trip eligibility has 'N' then the previous row trip number should be considered. i.e. the elibility flag 'N' indicates that that trip is single trip of previous record. Anyone can help for this??? Thanks.

Carrier	Truckno	Trip Elg	TripNo	SlNo
A	aa	Y	1	1
A	aa	N	1	2
A	aa	N	1	3
A	aa	Y	2	4
A	aa	Y	3	5
A	aa	N	3	6
A	aa	Y	4	7
A	bb	Y	1	8
A	bb	N	1	9
A	bb	Y	2	10
A	bb	Y	3	11
A	bb	Y	4	12
B	ac	Y	1	13
B	ac	N	1	14
B	ac	N	1	15
B	ac	Y	2	16
B	ac	N	2	17
B	ad	Y	1	18

Submitted under: Microsoft SQL Server · TSQL ·  ·  · 


imrajesh
1808 · 0% · 11

1 Replies

  • select *,row_number() over(order by Carrier,Truckno,Elg,Trip desc) TripNo from t

    commented on Feb 5 2014 2:57AM
    Leszek Gniadkowski
    8 · 18% · 5729

Your Reply


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]