dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: I need some help with campare values from mysql database

  1. #1
    Join Date
    Sep 2011
    Posts
    5

    Unhappy I need some help with campare values from mysql database

    Hi
    I have 1 database with 2 tables , every table have fields ... and I need to compare between the 2 fields and print the result , I may need just the function that makes the compare for this cases

    Case1
    table 1 with field named x
    contain 12

    Table 2 with field named y
    contain 12,15

    I need to print output as 12

    Case2
    table 1 with field named x
    contain 12,15

    Table 2 with field named y
    contain 12,15,20

    I need to print output as 12 and 15

    Case3
    table 1 with field named x
    contain 10,25,30

    Table 2 with field named y
    contain 10

    I need to print output as 10

    I already imploded these numbers and will explode it before or with compare
    Any help please?
    Last edited by zagarof2005; 10-14-2011 at 04:40 PM.

  2. #2
    Join Date
    Jul 2010
    Location
    /ramdisk/
    Posts
    865
    SELECT table1.* FROM table1 JOIN table2 USING(x,y);

    or if you did some csv/group_concat thing to get them like that:

    SELECT table1.* FROM table1 JOIN table2 ON FIND_IN_SET(table1.x,table2.y);



    I already imploded these numbers and will explode it before or with compare
    Don't do that, it generally makes the data harder to work with.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles