Skip to content
Advertisement

sqlite3 query to perform a operation twice [closed]

I am working with sqlite3 and I’ve created a view named collabs having columns id_1, id_2, count, score.

What I want is to extract data from above view as two rows for one row like if in database data is stored as (11, 44, 3, 55.8) I want to perform a query that would return (id, count, average) (11, 3, 55.8) (4, 3, 55.8)

Advertisement

Answer

That can be done with a union all operation:

But it is not clear why you called the third column ‘average’, what is it the average of?

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement