|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
select where t1.a = t2.a or t1.a = alternate t2.a
hopefully my title makes sense to people, but what i have is two tables (below is just an example not even close to real data)
t1 ------ file type ----- ------ FILE1 M FILE2 M FILE3 F t2 ------ server type available ----- ---- ----------- SER1 M true SER2 F false SER3 M true i want to select t1.file from t1,t2 where (at least one of the appropriate server type t2.available=true) so that only FILE1 and FILE2 are selected because SER2 is not available. but if SER2 were available, then all three in t1 would be selected. and if SER1 & SER3 were not available, no type M file would be returned hope this is clear. |
|
#2
|
|||
|
|||
|
Try something like
Code:
SELECT t1.file FROM t1 INNER JOIN t2 ON t1.type = t2.type WHERE t2.available = 'true' AND t1.type = 'M' |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > select where t1.a = t2.a or t1.a = alternate t2.a |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|