tom wang wrote:
Hi,
I have the following sql request:
[snipped, for the sake of the children]
As you can see I have two left outerjoins involving
the readerships table:
LEFT OUTER JOIN readerships ON readerships.topic_id =
topics.id
and
LEFT OUTER JOIN readerships readerships_topics ON
readerships_topics.topic_id = topics_posts.id
I'll take your word for it!
and I have a condition on both of those tables in my
where clause:
WHERE (readerships.read != '1' OR
readerships_topics.read != '1')
Not that I'm going to pretend to understand the goal of the query, but
couldn't you do:
LEFT OUTER JOIN readerships ON readerships.topic_id =
topics.id AND readerships.read != '1'
AND
LEFT OUTER JOIN readerships readerships_topics ON
readerships_topics.topic_id = topics_posts.id
AND readerships_topics.read != '1'
Now what I was wondering is: is there a way to write
something like :
WHERE *.read != '1'
Which would match all tables with a read column?
No, you cannott use the asterisk selector in a WHERE condition.
If not is there a way to match all readerships table
in my where clause?
so for example
WHERE readerships.read != '1'
where readerships.read would match both readerships
and readerships_topic?
readerships.read matches readerships.read, nothing more.
I can't just the left outer join part as it's
autogenerated but I can change the WHERE clause
Autogenerated by what, exactly? Does it run at all the way it is? That
is quite a monster SELECT statement. In fact, if it doesn't run now,
perhaps all it requires is a good jolt of electricity.
I'm not good a sql syntax, but I would love to
learn....
Are you reasonably certain that your SELECT requires all that? Could
your application maybe be adjusted so that you could break that up a little?
brian
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]