Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU |
Hi folks, dont know if this is the correct place for this, but I was wondering if there are any MySQL gurus out there who could help me with this. Problem : I want to select contents from "table aay", but only if it has relational records in "table bee" OR relational records in "table cee" Rationale : I have a store table, called "store_details". I want to be able to pick a random store from the store details table. However, as I dont want to display an empty or unready store, so I want to check and see if that store has items in it. These items can be stored in either of two tables, depending on the product being sold. Both product_table_two and product_table_one have the store_id key from store_details. So, in part-pseudo code it would look like : SELECT * FROM store_details , product_table_one, product_table_two, WHERE store_id >= (SELECT FLOOR( MAX(store_id) * RAND()) FROM page_details ) and BOTH (product_table_one AND Product_table_two) are NOT EMPTY ... ORDER BY so_store_id LIMIT 1 I just dont see how to get the 'either or' part going ... Can anyone help me ? thank you in advance, Richard -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. _______________________________________________ Discuss mailing list [hidden email] http://lists.blu.org/mailman/listinfo/discuss
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |