|
Posted by Andy Jeffries on 03/09/06 15:35
On Thu, 09 Mar 2006 14:31:14 +0100, Bob Bedford wrote:
> Hello there,
>
> I know this isn't a mysql NG, but I've no access to any good mysql
> newsgroup, and since most php coders also know mysql, I ask here.
>
> I've a table in wich I store pictures of articles. I've a field where I
> store the priority (let's say is the order the pictures are shown).
>
> So I've those fields in the database: articleID, imagepath, priority.
>
> So for article 455 I've this record:
> 455;455-1.jpg;1
> 455;455-2.jpg;2
> 455;455-3.jpg;3
>
> Now some articles have missing numbers priority. example article 24 has
> those records: 24;24-2.jpg;2
> 24;24-4.jpg;4
>
> I've up to 5 pictures per article. How to retrieve with a query all
> articlesID where I've priority 2 but not priority1 with mysql ?
SELECT articleID FROM ArticleTable GROUP BY articleID HAVING
MIN(priority)='2';
Is that what you meant?
Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos
[Back to original message]
|