In a primary election you choose the ballot of one party, and vote to select that party's candidate for the general election. As an example, before the 2008 Presidential election, Barack Obama won the Democratic Party primaries over Hillary Clinton, Dennis Kucinich, and several others; John McCain defeated fellow Republicans such as Fred Thompson & Ron Paul. Obama & McCain then ran against each other in the general election.
Peter