Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2006
    Location
    Istanbul, Turkey
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MySQL Query (Fantastic?

    Hi, i have this record(s) on my tablocuk table:

    Code:
    id  |  title     |  detail_ids
    -----------------------------------------------------
    2   |  Test      |  1, 11, 7, 19
    3   |  Test 2    |  8, 11, 19, 22
    I'm using this query:

    SELECT * FROM `tablocuk`WHERE `detail_ids` IN ('1', '11');

    And I can't get any reply from MySQL?

    Why? Please help me

    Thanks,
    -Mid
    Eggdrop Inc. - Application Developer
    http://www.eggdrop.gen.tr/

  • #2
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,169
    Thanks
    19
    Thanked 65 Times in 64 Posts
    well looking at the data you've supplied - if your table really looks like that, there are no matching results.
    your detail_ids field contains '1, 11, 7, 19' and '8, 11, 19, 22', you're looking for that field to be '1' or '11' - which it never is.
    A string is a string, and while I may be able to see what you're trying to do, mysql is not that smart - it does not know that the string in detail_ids is a set of comma separated values. Try normalising your data tables

    ...also, this is a mysql question and this is the php forum


  •  

    Posting Permissions

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