Wouldn't using LEFT OUTER JOINs in your query work instead of just a where
clause?  It still wouldn't give the optimum response but it would probably
give a usable one.  Unfortunately, I don't see a way to do what the user
really wants to do in MySQL.  In MySQL, the UNION clause does not mean what
it means in other implementations of SQL.

In M$ SQL you could use the UNION to aggregate 3 different select's into a
single result set, thus giving him 1 result set with all books, movies and
music from a single provider.  I usually add a field at the end of each
SELECT that contains a constant representing the source for that record.

Cal
http://www.calevans.com


-----Original Message-----
From: René Tegel [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 27, 2001 9:43 AM
To: René Tegel; Amazing-Books.Com; [EMAIL PROTECTED]
Subject: Re: Complexe query ....


excuse me, this just wouldn't work. and excuse last unfinished message.

if one on of the tables matches none, the query will return no match, which
is maybe not what you want.
else it'll return all data matched against each other, which is again not
likely what you want (since you get multiple results for each table).

guess you'll have to query each of the music, video and book tables seperate
to return sensefull results (read: presentable results).

only circumstance when this give nice results is when each book/video/music
table contains exactly one match.

sorry for too rapid answering...

regards,

rene


----- Original Message -----
From: "René Tegel" <[EMAIL PROTECTED]>
To: "Amazing-Books.Com" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 5:16 PM
Subject: Re: Complexe query ....


> select book.title, video.title, music.title from provider, book, video,
> music where provider.name='providername' and
> book.provider_id=provider.provider_id and
> video.provider_id=provider.provider_id and
> music.provider_id=provider.provider_id;
>
> ----- Original Message -----
> From: "Amazing-Books.Com" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, March 27, 2001 10:39 AM
> Subject: Complexe query ....
>
>
> Hi everybody. I got a complexe question well according to me. I am working
> with PHP and i am making some queries to some database. here is a
> description of the tables.
>
>       provider book video music
>       provider_id title title title
>       name provider_id provider_id provider_id
>
>
>
> I need to select all the title from book, video, music that matches a
> provider name and not a provider id.
>
> I know i can make 2 queries to do it but i am shure i can do a complexe
join
> somewhere that would allow me only to connect once. I want to do it this
one
> because to connect twince to a db could slow down the performance.
>
> This problem goes beyound my knowledge of MySQL a bit of help would be
> appreciated :-)
>
> Thanks
>
>
> Yann Larrivée
> www.ProtonicDesign.Com
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to