Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
181 views
in Technique[技术] by (71.8m points)

sql - Dynamic query to load a table based on assigned weightage

I have a source table Articles with 1000 records for furniture articles. Below are the records for each category.

Beds    150
Sofa    350
Chairs  250
Tables  250

I want to select 25 articles from each category every day and load the 100 articles into a Destination table and at the end of 10 days, all the articles will be available in the destination table. After few days of executions, there is no bed left to select from source table. In that case, it should give priority to Sofa and if sofa is finished then chairs and tables. Can anyone give me an idea of achieving it in SQL query? Thanks

question from:https://stackoverflow.com/questions/66061909/dynamic-query-to-load-a-table-based-on-assigned-weightage

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...