Home > database >  Oralce query
Oralce query

Time:09-25

Raw data column 1
111111235
111121237
111111239
111112341
111111234
111112236
111111238
111112340

According to the following four split into two columns


111111234, 111111235,
111111238, 111111239,
111112340, 111112341,
111112236, 111112237,

CodePudding user response:

Won't do, pass by, help top,

CodePudding user response:

What's rules, but the size of a sort, then the adjacent two together?

CodePudding user response:

refer to the second floor jdsnhan response:
what's rules, but the size of a sort, then the adjacent two together?

Ghost knows, break up the rules of what all don't say, any answers can be considered to be wrong,

CodePudding user response:

I see you after the results of a column is always smaller than previous column 1, if you want the result, the logic of know, I was but the Oracle to use less, grammar is not too clear, below is the MSSQL syntax, you can refer to the
 
--> --> The rain has stopped, & gt; Test data

If not object_id (N 'Tempdb for.. # TAB ') is null
Drop table # TAB
Go
The Create table # TAB (int [id])
Insert # TAB
111111235 union all select
111112237 union all select
111111239 union all select
111112341 union all select
111111234 union all select
111112236 union all select
111111238 union all select
111112340 UNION ALL select
111112342 UNION ALL select
Select 111112344
- the end of the test data

- rn parity modulus by 0 or 1
- the id of this column is used for grouping with
Select id, id % 2 AS an rn, CASE WHEN id % 2=1 THEN id 1 ELSE id END AS gb
INTO # tab2
The from # TAB
The ORDER BY gb

SELECT * FROM # tab2

Turn - line column shows
DECLARE @ name VARCHAR (Max), @ SQL VARCHAR (Max)
Set @ name=stuff ((SELECT DISTINCT, '[' + cast (rn) AS VARCHAR (20)) +'] 'the from # tab2 for XML PATH ('')), 1, 1, ' ')
Set @ SQL='SELECT [0], [1] from # tab2 pivot (Max (id) for rn (' + @ name +')) in a '
PRINT @ SQL
The EXEC (@ SQL)

CodePudding user response:

thank you for your reply, but there are some discrepancy and I want size you see
Similar to the following data

987654325
987654346
987654347
987654348
987654349
987654350
987654352
987654359
987654360
Only the last four, two columns show if there is the last two are 25,52 is priority show
987654325 987654352
If there is no
987654359 987654360
987654348 987654349

CodePudding user response:

reference qq646748739 reply: 3/f
Quote: refer to the second floor jdsnhan response:

What's rules, but the size of a sort, then the adjacent two together?

Ghost knows, break up the rules of what all don't say, anything can be considered to be the wrong answer,



thank you for your reply, but there are some discrepancy and I want size you see
Similar to the following data

987654325
987654346
987654347
987654348
987654349
987654350
987654352
987654359
987654360
Only the last four, two columns show if there is the last two are 25,52 is priority show
987654325 987654352
If there is no
987654359 987654360
987654348 987654349

CodePudding user response:

refer to the second floor jdsnhan response:
what's rules, but the size of a sort, then the adjacent two together?



thank you for your reply, but there are some discrepancy and I want size you see
Similar to the following data

987654325
987654346
987654347
987654348
987654349
987654350
987654352
987654359
987654360
Only the last four, two columns show if there is the last two are 25,52 is priority show
987654325 987654352
If there is no
987654359 987654360
987654348 987654349

  • Related