#7 joins returns wrong number of records

Current release
open
Daniel
6
2007-05-25
2007-05-25
No

It's easily reproducible (I may provide example if you want). Joints don't produce expected results, say

SELECT * FROM videos, categories WHERE videos.category_id=categories.id;

(returns wrong number of records; 1 instead of 2 or so)

Discussion

  • Daniel

    Daniel - 2007-05-25

    Logged In: YES
    user_id=799761
    Originator: NO

    There are also issues with nested expressions that I am going to fix very soon.

    Thank you for reporting!

     
  • Daniel

    Daniel - 2007-05-25
    • milestone: --> Current release
    • priority: 5 --> 6
     
  • Nobody/Anonymous

    Logged In: NO

    yes, it don't work correctly; try this:

    create table tb1(
    tb1id integer not null auto_increment,
    tb1c1 varchar(255),
    primary key (tb1id)
    );

    insert into tb1(tb1c1 ) values('val1');
    insert into tb1 values(3, 'val3');
    insert into tb1(tb1id, tb1c1 ) values(4, 'val4');
    insert into tb1(tb1c1 ) values('val_x');

    create table tb2(
    tb2id integer not null auto_increment,
    tb2c1 varchar(255),
    tb2_to_tb1id integer,
    primary key (tb2id)
    );

    insert into tb2(tb2c1, tb2_to_tb1id) values('ref to tb1 idx = 1', 1);
    insert into tb2(tb2c1, tb2_to_tb1id) values('ref to tb1 idx = 2', 2);
    insert into tb2(tb2c1, tb2_to_tb1id) values('ref to tb1 idx = 3', 3);

    select * from tb1;
    select * from tb2;

    select *
    from tb1, tb2
    ;

    select *
    from tb1, tb2
    where tb1.tb1id=tb2.tb2_to_tb1id
    ;

    the last select return just first row!!

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks