mysql - Why is this query duplicating results? -


i'm not experienced when comes joining tables may result of way i'm joining them. don't quite understand why query duplicating results. instance should return 3 results because have 3 rows specific job , revision, returning 6, duplicates same first 3.

          select                checklist_component_stock.id,                checklist_component_stock.job_num,                checklist_revision.user_id,                checklist_component_stock.revision,                checklist_category.name category,                checklist_revision.revision_num revision_num,                checklist_revision.category rev_category,                checklist_revision.per_workorder_number per_wo_num,                checklist_component_stock.wo_num_and_date,                checklist_component_stock.posted_date,                checklist_component_stock.comp_name_and_number,                checklist_component_stock.finish_sizes,                checklist_component_stock.material,                checklist_component_stock.total_num_pieces,                checklist_component_stock.workorder_num_one,                checklist_component_stock.notes_one,                checklist_component_stock.signoff_user_one,                checklist_component_stock.workorder_num_two,                checklist_component_stock.notes_two,                checklist_component_stock.signoff_user_two,                checklist_component_stock.workorder_num_three,                checklist_component_stock.notes_three,                checklist_component_stock.signoff_user_three                checklist_component_stock                left join checklist_category on checklist_component_stock.category                left join checklist_revision on checklist_component_stock.revision = checklist_revision.revision_num                checklist_component_stock.job_num = 1000 , revision = 1; 

tables structure:

checklist_category

i

checklist_revision

i

checklist_component_stock

i

the line

left join checklist_category on checklist_component_stock.category 

was supposed like

left join checklist_category on checklist_component_stock.category = checklist_category.category 

most other dbms have reported syntax error, mysql treats checklist_component_stock.category boolean. mysql boolean number, 0 false , != 0 true. every checklist_component_stock category != 0 being connected records in checklist_category.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -