Forum Moderators: coopster

Message Too Old, No Replies

Solving Query issue

         

dave1236

3:38 am on Jun 23, 2007 (gmt 0)

10+ Year Member



I am trying to join two tables (I can do this successfully) but I am trying to parse the resulting info for specific criteria (and this fails)

Here is the query I want to accomplish:

$query = "SELECT * FROM Links,Stores WHERE Links.store = Stores.storename AND WHERE DATE_SUB(CURDATE(),INTERVAL 5 DAY) <= entry AND entry <= '$today' AND expire > '$today' ORDER BY store ASC";

I run into issues when I add the following....
"AND WHERE..."

Any advice?

Thanks!

eelixduppy

3:48 am on Jun 23, 2007 (gmt 0)



Take out the WHERE after AND and see what you get.

dave1236

4:06 am on Jun 23, 2007 (gmt 0)

10+ Year Member



Thanks Eelix! That worked (although now I get different results than I expected -- some of my results are exclued)

dave1236

4:11 am on Jun 23, 2007 (gmt 0)

10+ Year Member



Does it matter which table I put first? (Links or Stores?)

dave1236

4:19 am on Jun 23, 2007 (gmt 0)

10+ Year Member



I figured it out...I had extra spaces in some rows..now I have to check each!

eelixduppy

1:44 pm on Jun 23, 2007 (gmt 0)



Glad you got it worked out :)