Bluehost.com Web Hosting $6.95

Can a local variable in MYSQL be a list?

This is a discussion on Can a local variable in MYSQL be a list? within the MySQL Database forums, part of the Database Forums category; Hi, I'd like to have a list of ID's that I can reuse in several queries in the ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-19-2007
mrsamme@gmail.com
 
Posts: n/a
Default Can a local variable in MYSQL be a list?

Hi,

I'd like to have a list of ID's that I can reuse in several queries in
the same sql-script.

Is this possible? I get ' Operand should contain 1 column(s)' when I
try this:
set @mylist := (139, 439, 7947);

What I want is to make (several) tables using this syntax:

create table foo
select
*
from
bar
where bar.ID in @mylist;

Cheers,
S

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 03:12 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0