Can you post your code? We might be able to find the problem more easily.
Update: Ah, ok, that's what I get for trying to think too early on Monday morning. I see what you're trying to do now (too many occurrences of SELECT confused my still-sleeping brain). Looks like plenty of people have shown you the answer, too.