question

SudheerReddy avatar image
0 Likes"
SudheerReddy asked SudheerReddy commented

SQL Query

As shown in below image I am trying to Query entries based on Priority first and then among same priority by distance.

For Example below entries Product2 and Product3 are Priority 1 and Product is Priority 2. So fist order by Priority and then after that out of Product2 and Product3 I would like order by distance.

Final result should look like Product 3 then Product 2 and then Product 1.

Any feedback on what SQL Query should I use.

FlexSim 20.1.2
flexsim 20.1.2sql querysortingorder by
priority.png (11.3 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joerg Vogel avatar image
1 Like"
Joerg Vogel answered SudheerReddy commented

You find a link in reference manual section for SQL queries in SQL Language Support to a more common site w3schools.com. There you find often more examples and variants of clauses than in FlexSim manual. This site help me a lot to build my query clauses. Here you need a query clause

ORDER BY .. ASC, .. DESC or ORDER BY .., .. ASC
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

SudheerReddy avatar image SudheerReddy commented ·

Thanks for feedback

0 Likes 0 ·
Patrick Zweekhorst avatar image
2 Likes"
Patrick Zweekhorst answered SudheerReddy commented

Hi @Sudheer Reddy,

You could use the following query in your pull from list:

ORDER BY Priority ASC, distance DESC
This query should do the trick, if not just let me know.
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

SudheerReddy avatar image SudheerReddy commented ·

It helped me...thank you

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.