| |

VerySource

 Forgot password?
 Register
Search
View: 1293|Reply: 10

Please help me

[Copy link]

1

Threads

7

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-26 20:00:01
| Show all posts |Read mode
I build a view
SELECT TOP 100 PERCENT *
FROM dbo.trade
WHERE (1 = 1) AND (id IN
          (SELECT MAX (id) AS id
         FROM trade
         GROUP BY comid))
ORDER BY memberType DESC

But because of this thing, the ID numbers themselves don't come in order, and some are like 10 after 15.
So I want to build another orderly ID for the view.
NEWID () AS AA
No, that's not a number
Reply

Use magic Report

0

Threads

88

Posts

55.00

Credits

Newbie

Rank: 1

Credits
55.00

 China

Post time: 2020-2-18 09:00:02
| Show all posts
IDENTITY (int, 1,1)
Reply

Use magic Report

0

Threads

211

Posts

108.00

Credits

Newbie

Rank: 1

Credits
108.00

 China

Post time: 2020-2-18 22:00:02
| Show all posts
--try

SELECT TOP 100 PERCENT ID = identity (int, 1, 1), * into #T
FROM dbo.trade
WHERE (1 = 1) AND (id IN
          (SELECT MAX (id) AS id
         FROM trade
         GROUP BY comid))
ORDER BY memberType DESC

select * from #T
Reply

Use magic Report

1

Threads

7

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-7-22 18:15:01
| Show all posts
The query designer does not support the IDENTITY SQL construct.
Reply

Use magic Report

0

Threads

88

Posts

55.00

Credits

Newbie

Rank: 1

Credits
55.00

 China

Post time: 2020-7-22 20:15:02
| Show all posts
goingdown11


   The query designer does not support the IDENTITY SQL construct.
  

-------------------------------------------------- ------------
Impossible, just use the IDENTITY (int, 1,1) function to insert into a new table
Reply

Use magic Report

1

Threads

7

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-7-23 09:45:01
| Show all posts
Hey, I'm so stupid, I made a mistake, this is written in the view, it turns out to be inserted into a new table, I understand
Reply

Use magic Report

1

Threads

7

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-7-23 10:00:01
| Show all posts
What about such a huge amount of data?
Reply

Use magic Report

1

Threads

7

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-7-23 15:45:01
| Show all posts
This seems to be limited in practical use. Do I create a table every time I check it?
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-7-23 19:45:01
| Show all posts
You can add a drop table #T
Reply

Use magic Report

1

Threads

7

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-7-23 23:00:01
| Show all posts
Well, I considered this, but now there are several problems
First, since I want to sort, then, if you check the first page, it will be easy to transfer 20 data to the record set
Then if I check every two pages, I will pass forty records to a new table.
Then look for the last 20 data
But the third page is about to pass sixty articles
There are 80 items on the fourth page, and the speed is greatly affected
Second, then the table name is a problem. As a member, I can generate a table based on his user name, but if a non-member checks, what about the concurrency problem?
Third, the issue of permissions, this is also a big issue, will it have an impact, if there is someone, think of a way to insert 10,000 tables in my library, what should I do?

Solve it
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list