LMSouq
database Open

Set user variable from result of query

AV
Avada Kedavra
1 month ago
3 views
Problem Description
Is it possible to set a user variable based on the result of a query in MySQL? What I want to achieve is something like this (we can assume that both `USER` and `GROUP` are unique): set @user = 123456; set @group = select GROUP from USER where User = @user; select * from USER where GROUP = @group; Please note that I know it's possible but I do not wish to do this with nested queries.

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base