Hi,
although you whispered I heard you loud and clear. Using inner
join seems to generate the desired result. A sample query is this:
SELECT DISTINCT pivientities.Entityid FROM pivientities, pivicategories
INNER JOIN pivicategories ON pivientities.Entityid=pivicategories.Entityid
WHERE 1=1 AND pivientities.Entitytype = 'pic' OR
pivicategories.Category_name='Alton' OR
pivicategories.Category_name='Bristol' OR
pivicategories.Category_name='Soft' ORDER BY pivientities.Creation_date ASC
I intentionally added the 1=1 after WHERE so that I can concatenate the
portions of the query and have the portions start with AND or OR without
creating syntax errors. I allow for excluding particular restrictions so I
cannot forsee which portion comes first as it may not be in the query at
all. Someone else whispered that tip a long time ago.
Does that look like something that holds up or did you get a good laugh?
Thanks for the tip!!
David K.
At 12:05 PM 10/8/2006, you wrote:
>On Sun, 2006-10-08 at 11:11 -0400, David Krings wrote:
>
> > Any tip is greatly appreciated. It for sure will make me less dumb. It
> > is really fascinating how sth so trivial can be so complicated.
>
>Just a tip... <whispers> "join"
>
>http://dev.mysql.com/doc/refman/5.0/en/join.html
More information about the ECLUG mailing list