View Single Post
Old 09-07-2007, 12:24 PM   #2 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Isn't it @myVar:= and not $v1:=? In any case, I do like the way you do it for the sub-selects, but I also like the way variables can make things much more readable.

For instance:

Code:
SELECT
	@count:=COUNT(*)
FROM
	myTable
HAVING
	@count > 1
Obviously this is a useless example but it's how I use the variables for on such statements as inner joins where the query can get somewhat complex.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote