Page 1 of 1

Simplify Query

Posted: Mon Dec 18, 2006 8:31 am
by WanamakerStudios
Is there a way to simplify this part of my query?

Code: Select all

LEFT JOIN `options` o1
		ON o1.CIDOPTI = v.O1
		LEFT JOIN `options` o2
		ON o2.CIDOPTI = v.O2
		LEFT JOIN `options` o3
		ON o3.CIDOPTI = v.O3
		LEFT JOIN `options` o4
		ON o4.CIDOPTI = v.O4	
		LEFT JOIN `options` o5
		ON o5.CIDOPTI = v.O5
		LEFT JOIN `options` o6
		ON o6.CIDOPTI = v.O6
		LEFT JOIN `options` o7
		ON o7.CIDOPTI = v.O7

Posted: Mon Dec 18, 2006 8:32 am
by feyd
possibly with IN()

Posted: Mon Dec 18, 2006 8:35 am
by WanamakerStudios
Would you be able to provide an example?

Posted: Mon Dec 18, 2006 8:47 am
by feyd
If memory serves, you are able to reference fields within the IN(). That really shouldn't need an example.

Posted: Mon Dec 18, 2006 9:04 am
by WanamakerStudios
I know how to reference IN() in the JOINs ... but am not quite sure how to do it with multiple fields in one table against one field in a second table ...