Hi,

I am guessing this is the kind of problem that would be easier to solve with
a sub select


SELECT
simpleparts.category,simpleparts.partnumber,simpleparts.manufacturer,simplep
arts.descrp,ABS(packagesParts.pri) as abPRI,categories.sortorder
FROM ((packagenames LEFT JOIN packagesParts ON packagenames.packageID =
packagesParts.packageID) 
LEFT JOIN simpleparts ON packagesParts.partnumber = simpleparts.partnumber) 
LEFT JOIN categories ON simpleparts.category = categories.category
WHERE simpleparts.configurator <>0
AND categories.onconfig <>0
AND packagenames.packagename = $system_name
AND simpleparts.category = ?
ORDER BY abPRI DESC

This in one case returns


------------------+------------+--------------+---------------------+------+
-----------+
| category         | partnumber | manufacturer | descrp              | pri
| sortorder |
+------------------+------------+--------------+---------------------+------
+-----------+
| Game Controllers | 234232     | Jumbo Video  | Video card      |    1 |
24 |
| Hard Drives            | 78544      | HTH          | a Drive controller
|    1 |        12 |
| Floppy Drives         | HP-4p      | HP           | 4P - 48bit
|    1 |        13 |
| CPUs               | int-550c   | Intel        | Celeron 500MHZ 128K   |
1 |         1 |
| Memory           | mem-102    | who knows    | 256M 120pin         |    1
|         3 |
| Scanners         | 9955       | Acer         | 10 ISA
|    0 |        22 |
| Game Controllers | game-01    | Atari        | Simple stick            |
0 |        24 |
| CPUs             | INT550     | INTEL        | PIII 550 CPU
|    0 |         1 |
| Memory           | mem-101    | who knows    | 128M
|    0 |         3 |
| Modems           | mod-124    | USR          | sportster 28.8
|    0 |         9 |
+------------------+------------+--------------+---------------------+------
+-----------+

But I have one more constraint that I would like to be able to include in
the query and not deal with in code.

I want to not return anything in the case where none of the
packagesParts.pri  are = 0  this is hard because I do what those 
packagesParts.pri =0 where there is a packagesParts.pri = 1 in the result set.


Is there a way to cram this into my query with mysql as it stands? 


I saw some people here do some pretty fancy stuff, so I thought it was worth
asking. 


Thanks,

Eric 


Frazier Consulting
http://www.kwinternet.com/eric
(250) 655 - 9513




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