[thelist] Need help from any mySQL gurus on the list

Andy Warwick mailing.lists at creed.co.uk
Wed Mar 30 16:42:11 CST 2005


On 30 Mar 2005, at 23:19, Matt Warden wrote:

> Hi Andy,
>
> On Wed, 30 Mar 2005 22:19:58 +0100, Andy Warwick
> <mailing.lists at creed.co.uk> wrote:
>> That gets me *all* the private stories, but includes those that are
>> also public at the same time.
>
> Before I go build some crazy query to get around how most versions of
> MySQL don't support subqueries, could you confirm the version of MySQL
> you are using here?

Hi Matt.

Don't sweat it.

A very old one :)

I've hacked up a solution in the surrounding PHP; it 'aint purdy but it 
works.

The problem has been a last-minute change of specs from the client that 
the database structure was never designed to fulfill, and now the 
database is full of data and I don't have access to change the 
structure.

<sigh>

Basically I bail out of that iteration of the loop if there's more than 
one desk for that story.

I'm not proud of the code, but they've had the specs for months, and 
only decide to change it in the last week before deployment.

On 30 Mar 2005, at 23:16, Richard Harb wrote:

> SELECT ns.uid, ns.title, nd.title
> FROM news_stories ns
> JOIN news_desk_stories nds ON ns.uid=nds.story
> JOIN news_desk nd ON nd.uid=nds.desk
> WHERE nd.title = 'private'

Thx Richard; I'll have a look at that after the project has gone to bed 
and see if it would have helped. For now, I'll just go with a hack :)

Cheers anyway; always useful to have this kind of stuff for future 
reference.

Thx both.

-- 
Andy Warwick
Creed New Media. <http://www.creed.co.uk>



More information about the thelist mailing list