I made some SQL tables and when I run a request query I get duplicated lines. Whereas if I run a request query with the same conditions but I type in only 1 table, the data are correct and are not duplicated.
Can you explain why?
I made some SQL tables and when I run a request query I get duplicated lines. Whereas if I run a request query with the same conditions but I type in only 1 table, the data are correct and are not duplicated.
Can you explain why?
If you have a 1-N relationship between table1 and table2 and you do:
You will have N resulting lines for each record in your table1Code:select * from table1 left join table2 on table1.id=table2.id_table1
Yeah that's true but how to solve the problem?
Could you give your request query so that I would see it and help you accordingly.
Code:SELECT tic.ticket_id, tic.ticket_label, tic.ticket_detail, tic.ticket_date_o, tic.ticket_date_f, tic.ticket_priority, tic.ticket_destination, tic.ticket_close, si.servInfo_label, app.app_name FROM ticket tic, applicant app, service_info si WHERE app.app_num = tic.ticket_applicant_num AND tic.ticket_servInfo_num = si.servInfo_num AND tic.ticket_label like 'password%%' OR tic.ticket_detail like 'password%%' ORDER BY tic.ticket_id desc;
An example of incorrect query!
Basically, if your applicants are double in the database you will get duplicated results. That describes the problem effectively.
Bookmarks