Mysql local variables Source

1---
2title: 'Mysql local variables'
3date: '2007-05-10'
4published_at: '2007-05-10T09:50:00.000+10:00'
5tags: ['code', 'mysql', 'programming']
6author: 'Gavin Jackson'
7excerpt: 'Just learned how to use variables in mysql - the variables are bound to the specific client session - and are destroyed on disconnect. SET @varname = value SELECT max(value) from table into @varname S...'
8updated_at: '2007-05-10T10:11:31.076+10:00'
9legacy_url: 'http://www.gavinj.net/2007/05/mysql-local-variables.html'
10---
11
12Just learned how to use variables in mysql - the variables are bound to the specific client session - and are destroyed on disconnect.
13
14```
15SET @varname = value
16
17SELECT max(value) from table into @varname
18
19SELECT @varname
20```
21
22More documentation is available at [http://dev.mysql.com/doc/refman/5.0/en/user-variables.html](http://dev.mysql.com/doc/refman/5.0/en/user-variables.html)
23
24
25