I'm trying to join table with itself but with no luck.
my tables contains:
ID Name Position
1 Jefferson Roxas president
2 Carlson Zafiro president
3 Andrew Anderson vice president
9 Jayson Dela Cruz representative
10 Arille Villanueva Valdez representative
11 Arnold Baltazar representative
The result of query that I want is:
ID Name Position ID Name Position ID Name Position
1 Jefferson Roxas president 3 Andrew Anderson vice president 9 Jayson Dela Cruz Representative
2 Carlson Zafiro president 10 Arille Villanueva Valdez Representative
11 Arnold Baltazar Representative
I am using this query:
Select a.idcandidates, a.position, b.idcandidates, b.position , c.idcandidates, c.position
from tbl_candidates a, tbl_candidates b, tbl_candidates c
where a.position='president' and b.position='vice president' and c.position='representative'
but the result was
ID Name Position ID Name Position ID Name Position
1 Jefferson Roxas president 3 Andrew Anderson vice president 9 Jayson Dela Cruz Representative
2 Carlson Zafiro president 3 Andrew Anderson vice president 10 Arille Villanueva Valdez Representative
1 Jefferson Roxas president 3 Andrew Anderson vice president 11 Arnold Baltazar Representative
2 Carlson Zafiro president 3 Andrew Anderson vice president 9 Jayson Dela Cruz Representative
1 Jefferson Roxas president 3 Andrew Anderson vice president 10 Arille Villanueva Valdez Representative
2 Carlson Zafiro president 3 Andrew Anderson vice president 11 Arnold Baltazar Representative