I
I
Ivan Petrov2016-11-17 19:13:19
MySQL
Ivan Petrov, 2016-11-17 19:13:19

What happens in this short sql query?

SELECT 
        899926 as user_id,
        tt1.page_id
FROM
(SELECT DISTINCT page_id  FROM dbo.user_page_access_relationship) as tt1

what happens in this line - SELECT 899926 as user_id ? After all, you need to write the name of the column, but not the value.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2016-11-17
@bitande

You can add any static value to the selection, there is nothing special about it.
In this case, a fixed user ID is added to each line with page_id. It is not very clear why this should be done - either the author of the code played too much, or there really was some kind of need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question