Re: looping through an array problem

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

 



Ah. I just remembered one reason I had done it involving the art_id field:

I have more publishers in the db than are currently associated with artworks. I don't want a publisher to appear unless there is at least one image associated with it. So I did this to avoid having people see a link to the Sneezy Acres Tribune only to arrive at the next page and see, "There are no images associated with this publisher."




Jochem Maas wrote:
Jack Jackson wrote:



M. Sokolewicz wrote:

Jack Jackson wrote:

Thanks for all the replies. Jochem, thank you for this code, which will take me all night to understand (though I bet it works). I also note that SELECT DISTINCT worked here, too

Also as many of you noticed before me, the art_id was in there as a fly in the ointment.



by that statement I ment the exact same thing Jochem ment in his 2nd part; I have NO idea why you're selecting *ANYTHING* from the arts table... it's *useless* if you don't need the data...



Er, yes, that was what I meant: I had unintentionally included that bit.Thank you for your help.


Er, Jack - your original query was:

SELECT art.art_id,art.publisher_id,publisher.publisher_name,
FROM art
LEFT JOIN publisher
ON publisher.publisher_id=art.publisher_id

which is a selection on the art table... ( with a typo)
if you did:

SELECT art.publisher_id,publisher.publisher_name
FROM art
LEFT JOIN publisher
ON publisher.publisher_id=art.publisher_id

nothing would change. and if you did:

SELECT publisher.publisher_id,publisher.publisher_name
publisher

i.e. not 'unintentionally' selecting from the arts table.
then you would not have had a problem in the first place?!

I think I'm missing something ;-)


--
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