Oh boy, you are screwing the query royally. Use the joins as mentioned by gamyers.
http://www.perf-engg.com A performance engineering forum
Forum Rules