Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8758893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:39:56+00:00 2026-06-13T14:39:56+00:00

Supose I have data in below format FIELD1 F2 F3 LIN0_TMP A0 1 LIN0_TMP

  • 0

Supose I have data in below format

FIELD1   F2       F3 
LIN0_TMP    A0  1
LIN0_TMP    B0  2
LIN0_TMP    C0  3
LIN_TMP     A   1
LIN_TMP     B   2
LIN_TMP     C   3
LIN_TMP     D   4
LIN2_TMP    A2  1
LIN2_TMP    B2  2
LIN2_TMP    C2  3
LIN2_TMP    D2  4

i WANT output in below format using oracle sql query.

FIELD1   F2       F3   FLOW
    LIN0_TMP    A0  1 FLOW1
    LIN0_TMP    B0  2 FLOW1
    LIN0_TMP    C0  3 FLOW1
    LIN_TMP     A   1 FLOW2
    LIN_TMP     B   2 FLOW2
    LIN_TMP     C   3 FLOW2
    LIN_TMP     D   4 FLOW2
    LIN2_TMP    A2  1 FLOW3 
    LIN2_TMP    B2  2 FLOW3
    LIN2_TMP    C2  3 FLOW3
    LIN2_TMP    D2  4 FLOW3

Number of record for field1 is not fixed for each LIN_TMP value..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:39:57+00:00Added an answer on June 13, 2026 at 2:39 pm

    This solution uses an analytic sum to generate a running total of the number of times F3 = 1.

    select field1
          , f2
          , f3
          , 'FLOW'||trim(to_char(rnk))
    from 
         (select field1
          , f2
          , f3
          , sum(case when f3 = 1 then 1 else 0 end)
         over (order by field1, f3 range between unbounded preceding and current row) rnk
        from your_table )
    

    Here is the SQL Fiddle.

    As I mentioned in my comment, your sort order for FIELD1 is wack, so you will need to supply your own ORDER BY column for the window clause.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have an SQL query using Oracle SQo Server to get the data
Suppose I have a text file with data like below, I want to read
I have data in a mysql table in long / tall format (described below)
Suppose I have div and I want to fetch data and push data into
I have a sequential dataset which has some data formatted in columns. suppose below
I'm having a problem with Crosstab query in SQL Server. Suppose that I have
Suppose I have one button, and I want it to fetch data (like an
This is a general question. Using an example below, suppose that I have a
-- This is an updated post, old post removed -- Suppose I have data
Suppose I have core data entities A and B, where B points to A

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.