Welcome to WebmasterWorld Guest from 34.204.176.189

Forum Moderators: open

Message Too Old, No Replies

craftin mysql query

exclude results by checking in another table

     
3:35 pm on Sep 24, 2009 (gmt 0)

New User

5+ Year Member

joined:Sept 24, 2009
posts:4
votes: 0


Hello all, I need some help with this query.. The query is very long so I'm not posting it here unless it'll really be necessary. Basically it gets some rows from table products by some terms and Left JOINs other tables checking some stuff there. Now I need the following: There are dates when those products are reserved so I need to exclude those from the result based on provided date range something like
SELECT FROM #__properties_available_product'
.' WHERE id_product = ' .$prop_id
.' AND date BETWEEN "'.$start.'" AND "' .$end. '"'; But to exclude those from the result.

Thanks
4:28 pm on Sept 24, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


" .... and (tablename.date < "'.$start.'" AND tablename.date > "' .$end. '")'
4:50 pm on Sept 24, 2009 (gmt 0)

New User

5+ Year Member

joined:Sept 24, 2009
posts:4
votes: 0


don't think its the right way: the dates table has only unavailable dates if there are any. the table goes like this:
id_product - id's
dates - 1 per row so there may be 10 dates for the same product. What I need to do is to find those products that are unavailable at the provided date range and exclude them from the result.
9:27 pm on Sept 24, 2009 (gmt 0)

New User

5+ Year Member

joined:Sept 24, 2009
posts:4
votes: 0


ok got it, you have to use left outer join, some tricky syntax but its fine and working now.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members