RE: difficult select problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: PJ
> First, let me thank you all for responding and offering suggestions. I
> appreciate it and I am learning things.
> However, it looks like my message is not getting across:
> The problem is not to retrieve only the authors whose last names begin
> with A:

Actually, it appears you simply don't like the accurate answers you have
been given. 

> 1) which books have a second author?
> 2) who is the second author ?
> This is determined by table book_author column ordinal (which can be 1
> or 2) - if there is only 1 author for a book then there is no ordinal
2
> linked to book_author bookID and authID.

There is no way to do that in a single select. You need to have at least
two and possibly three queries to answer your question. First you get a
list of authors where their name begins with 'A'. Then you use that
result to select a list of all books with more than one author. Then you
can use that result to select all authors for them.

Everyone has told you this requires processing beyond what SQL can
provide. Why is that a problem?

Bob McConnell

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux