Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Storing multiple value field in a MySQL database

by roboticus (Chancellor)
on Nov 25, 2013 at 20:05 UTC ( #1064286=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $members = join("; ", @member);
    
  2. or download this
    select * from celebrities where professions like '% 002 %'
    
  3. or download this
    select * from celebrities 
    where professions='002'          -- The only item in the list
    or    professions like '002 %'   -- it might be first of several
    or    professions like '% 002'   -- it could be the last of several
    or    professions like '% 002 %' -- or in the middle
    
  4. or download this
    if 1 > (select count(*) from celebrities 
            where (professions='002' or professions like '002 %'
    ...
                                        else ' '||professions end
        where cel_id=X;
    end if;
    
  5. or download this
    select * from celebrities where cel_id in (
        select cel_id from celebrity_professions where prof_id='002'
    )
    
  6. or download this
    if 1 > (select count(*) from celebrity_professions where 
            prof_id='002' and cel_id=X
    ) then
       insert into celebrity_professions (cel_id, prof_id) values (X, '002
    +');
    end if;
    
  7. or download this
    delete celebrity_professions where cel_id=X and prof_id='002';
    
  8. or download this
    select * from celebrities where cel_id in (
        select cel_id from celebrity_groups where group_id in (
            select prof_id from celebrity_groups where cel_id=X
        )
    )
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1064286]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2015-07-06 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (84 votes), past polls