D
D
Denis Lvov2020-09-09 15:52:23
Oracle
Denis Lvov, 2020-09-09 15:52:23

In oracle how to output the data portionwise by condition?


1. Table (City, Data1 , Data2), 2. Table (City, Quantity) - "Quantity" is simply ROW_NUM for Table1 -va lines for this city. And so on throughout the list

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Lvov, 2020-09-09
@dwenlvov

Sorry, I found it myself:

SELECT * FROM(
    SELECT
        ROW_NUMBER() OVER(PARTITION BY CITY ORDER BY CITY) row_num,
        DATA1,
        DATA2,
        CITY 
    FROM TABLE1)t1
WHERE t1.row_num BETWEEN 1 AND (select t2.COUNT from TABLE2 t2 where t1.CITY = t2.CITY);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question