SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Free me php klassicd's Avatar
    Join Date
    Sep 2001
    Location
    San Diego
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL Query Possible?

    Hey everyone.

    I have a column in one of my tables that carries information in this format:
    0,1,0,0,1,0,1

    Basically its just some personal information collected in a survey. What I need to do is select all users that have 1 for the 4th item in the value.

    For example:
    0,1,0,0,1,0,1

    Is there anyone to do this in a query? I could do it in php but i would need to select row by row and check each value. Just wondering if mysql has something like select * from table where columnname[6]=1;

  2. #2
    My precious!!! astericks's Avatar
    Join Date
    Mar 2002
    Location
    Vancouver, BC
    Posts
    1,971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try using the substring feature for mysql

    SELECT SUBSTRING('0,1,0,0,1,0,1',5,1);

    it should work.

  3. #3
    Free me php klassicd's Avatar
    Join Date
    Sep 2001
    Location
    San Diego
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks works great.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •