JongMin Posted March 15, 2016 Share Posted March 15, 2016 Hi, there Please see the followng query: SELECT * FROM table AS t WHERE id='%1\$s' ORDER BY -t.time'; Could you explain what is %1\$s thing and minus sign in the ORDER BY clause? Is there a website or some kind of link that I can refer to? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/301005-strange-mysql-syntax/ Share on other sites More sharing options...
Jacques1 Posted March 15, 2016 Share Posted March 15, 2016 This is hardly MySQL syntax. When you look at the context of the query, I'm sure you'll find that it's actually a sprintf() expression with “%1$s” referring to the first argument. The negative sign in the ORDER BY clause might be a very odd way of getting a descending order (there's a DESC keyword for that). But then again, context is everything. Quote Link to comment https://forums.phpfreaks.com/topic/301005-strange-mysql-syntax/#findComment-1532012 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.