Home > database >  Like a piece of table, without a primary key, how to use SQL statements into the second table
Like a piece of table, without a primary key, how to use SQL statements into the second table

Time:09-27


In SQL statement execution how to write, table named t1


CodePudding user response:

Only know that this model is simple but can't be used,,,

CodePudding user response:

The month=
Row_number () over (parti by year order by year)

CodePudding user response:

SELECT * FROM
(SELECT YEAR, MONTH, COUNT the FROM t1 ORDER BY YEAR, MONTH) t
WHERE ROWNUM<=9
The MODEL
DIMENSION BY (YEAR, MONTH)
MEASURES (COUNT)
RULES
(COUNT (2003, 2]=COUNT 2002, 2 + 1,
COUNT=COUNT [2003] [2002] + 1,
The COUNT (2003, 4]=COUNT [2002] + 1)
The ORDER BY YEAR and the MONTH

CodePudding user response:


No hint this error, how to deal with

CodePudding user response:

Select year, row_number () over (partition by year order by year) the month and year - 2000 + row_number () over (partition by year order by year) * 0.1 from t1

CodePudding user response:

reference 5 floor mayanzs reply:
select year, row_number () over (partition by year order by year, month, year - 2000 + row_number () over (partition by year order by year) * 0.1 from t1
no

CodePudding user response:

All are increasing

CodePudding user response:

SELECT YEAR, MONTH,
DENSE_RANK () OVER (ORDER BY YEAR) | | '. '| | ROW_NUMBER () OVER (PARTITION BY YEAR ORDER BY MONTH)
FROM the TABLE

CodePudding user response:

SELECT YEAR, ROW_NUMBER () OVER (PARTITION BY YEAR the ORDER BY the MONTH) AS the MONTH,
DENSE_RANK () OVER (ORDER BY YEAR) | | '. '| | ROW_NUMBER () OVER (PARTITION BY YEAR ORDER BY MONTH)
FROM the TABLE
The month also according to the grouping, year increments

CodePudding user response:

refer to the eighth floor chengccy response:
SELECT YEAR, MONTH,
DENSE_RANK () OVER (ORDER BY YEAR) | | '. '| | ROW_NUMBER () OVER (PARTITION BY YEAR ORDER BY MONTH)
FROM the TABLE

It is good to have a primary key figure, 9 and 10 main just is not good
  • Related