Home : General : Databases and SQL :

General: Databases and SQL: Re: [Stealth] Help with printing to file...: Edit Log

Here is the list of edits for this post
Re: [Stealth] Help with printing to file...
I'm thinking for someone new to mysql it's going to be a nasty learning curve to get that query. Frown Offhand, assuming it's using basic relations, the query is going to look something like this. I didn't test this so I'm sure it won't work right away.

Code:
SELECT V.votername,
SUM( C.name = 'wanted_nameA' = O.name = 'wanted_nameA' ) AND
SUM( C.name = 'wanted_nameB' = O.name = 'wanted_nameB' ) as match

FROM
Candidates as C, Votes as V, Offices as O

WHERE
C.name = O.candidate_name_fk
and C.name = V.candidate_name_fk

GROUP BY V.votername

HAVING match

ORDER BY V.votername

Otherwise, it may just be best to write a program and get used to the DBI.

Last edited by:

Aki: Sep 12, 2002, 4:43 PM

Edit Log: