MySQL Forums
Forum List  »  PHP

Re: Problem with SQL query :(
Posted by: Sebastian Maur
Date: January 22, 2014 09:48AM

Rick James Wrote:
-------------------------------------------------------
> Gag. EAV! One of the worst schemas around.
>
> Anyway, you need some self JOINs...
>
> > ( label = 6 AND properties IN (35,5) ) AND
> > ( label = 7 AND properties IN (7,8) )
>
> AND won't work; OR will
>
> > ( label = 6 AND properties IN (35,5) ) OR
> > ( label = 7 AND properties IN (7,8) )
>
> means something like "Phone that is WHITE OR GRAY
> _or_ it should have Simlock for Telering or
> Vodafone"
>
> If you want "Phone that is WHITE OR GRAY _and_ it
> should have Simlock for Telering or Vodafone",
> then you need two JOINs into Properties:
> SELECT ... FROM ...
> JOIN Properties color ON ...
> JOIN Properties slock ON ...
> WHERE
> color.label = 6 AND color.properties IN (35,5)
> AND
> slock.label = 7 AND slock.properties IN (7,8)
>
> Getting messy? Welcome to key-value schema!
> Here's my blog on the topic:
> http://mysql.rjweb.org/doc.php/eav

I read that but Im still not able to get it work, Ive never worked with JOINS and i read couple of "tutorials and descriptions" but whatever I try, it's not working the only result I get is the same as before which isnt right, or syntax error..

What comes after the ON ? Or how is this build, I dont understand it how to make multiple JOINS, one I could make but how I do one in another one ?

Options: ReplyQuote


Subject
Written By
Posted
January 18, 2014 10:39PM
January 19, 2014 12:30PM
January 19, 2014 12:41PM
January 20, 2014 03:24PM
January 21, 2014 06:22PM
Re: Problem with SQL query :(
January 22, 2014 09:48AM
January 22, 2014 04:19PM
January 23, 2014 12:15AM
January 23, 2014 10:23AM
January 19, 2014 12:33PM


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.