A
A
Alexey Nikolaev2015-10-09 21:13:20
PHP
Alexey Nikolaev, 2015-10-09 21:13:20

What does this SQL expression mean?

Good time.
I came across an incomprehensible structure in the request:

SELECT `a_products`.`season_alias`, (`a_products`.`season_alias` %2) AS seasons_alias_order

What does %2 mean, given that it's not a placeholder (the request is executed exactly as written)? Is it true that this allows you to display the same field several times under different aliases, or does it have some additional effect?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivanq, 2015-10-09
@Heian

% is the operator for getting the remainder of a division. Literally, the query reads:
Take the season_alias field from the a_products table and then add the season_alias_order column, equal to the remainder of the season_alias field from the a_products table divided by 2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question