mardi 13 octobre 2015

query returns multple time the record

I have a table1(id, and some other columns) and table2 (id, name, surname) where in table1 I have records for a particular id when i execute this query

SELECT table1.date, table1.id, table1.shift, table1.wp, table2.name, table2.surname 
FROM table1, table2 
WHERE date='2015-10-13' AND table1.id=table2.id ORDER BY wp

I get much more records. E.g. I expect to get sth like

"2015-10-13","97","1","1","john","Smith"
"2015-10-13","98","1","2","will","Sdsmith"

I get

"2015-10-13","97","1","1","john","Smith"
"2015-10-13","97","1","1","john","Smith"
"2015-10-13","97","1","1","john","Smith"    
"2015-10-13","97","1","1","john","Smith"
"2015-10-13","98","1","2","will","Sdsmith"
"2015-10-13","98","1","2","will","Sdsmith"
"2015-10-13","98","1","2","will","Sdsmith"
"2015-10-13","98","1","2","will","Sdsmith"

Aucun commentaire:

Enregistrer un commentaire