MySQL Forums
Forum List  »  General

Re: Define one Subquery for multiple statements
Posted by: Peter Brawley
Date: January 11, 2015 02:05PM

> I can't Change the design

Why not?

Your best alternative is to get the terms of your employment straightened out so you're a programmer rather than a clerk.

Failing that, you need to write an inefficient query, eg ...

select distinct a.id
from tbl a
join tbl b on a.column1=b.`column` and b.power between 1 and 3
join tbl c on a.column2=c.`column` and c.power between 1 and 3
join tbl d on a.column3=d.`column` and d.power between 1 and 3 ;

The query will need an index like (column,column1,column2,column3,power)

Options: ReplyQuote


Subject
Written By
Posted
Re: Define one Subquery for multiple statements
January 11, 2015 02:05PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.