Return result of query as variable

can you help me please?