SunQuest
 
           MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old October 19th, 2004, 06:38 PM
nara_fugu nara_fugu is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 1 nara_fugu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old December 4th, 2004, 11:25 AM
Madpawn Madpawn is offline
My beat is correct.
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 339 Madpawn User rank is Private First Class (20 - 50 Reputation Level)Madpawn User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 22 h 3 m 33 sec
Reputation Power: 4
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'

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > select where t1.a = t2.a or t1.a = alternate t2.a


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway