Guys,

Below is a select query which I'm stuggling with, so I'd be grateful for any
help you could give me.

select distinct TraderPersonalInfo.TraderID,PlatformMap.PlatformID from
TraderPersonalInfo,Locations,PlatformMap,Platforms where
(TraderPersonalInfo.TraderID = PlatformMap.TraderID) and
(PlatformMap.PlatformID = Platforms.PlatformID) and PlatformMap.PlatformID =
2 or PlatformMap.PlatformID = 4;

The query above produces the following output:

+----------+------------+
| TraderID | PlatformID |
+----------+------------+
|        5 |          4 |
|        4 |          4 |
|        1 |          4 |
|        2 |          4 |
|        3 |          4 |
|        6 |          4 |
|        7 |          4 |
|        9 |          4 |
|       10 |          4 |
|       11 |          4 |
|       20 |          4 |
|       13 |          4 |
|       14 |          4 |
|       15 |          4 |
|       19 |          4 |
|       17 |          4 |
|       18 |          4 |
|       23 |          4 |
|       22 |          4 |
|       24 |          4 |
|        2 |          2 |
|        5 |          2 |
|        6 |          2 |
|        7 |          2 |
|        9 |          2 |
|       10 |          2 |
|       11 |          2 |
|       22 |          2 |
+----------+------------+

but, I only want to know which traders have platformID 2 *and* platformiID4. 
In this case, only traderID 5 has both.  I can't seem to work out how to
structure the statement so it works as a *AND*, not *OR* as above.

Any help would be greatly appreciated.

Cheers.

- Lee.


-- 
View this message in context: 
http://www.nabble.com/struggling-with-select-query-tf3300643.html#a9181415
Sent from the MySQL - General mailing list archive at Nabble.com.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to