3 Replies - 543 Views - Last Post: 02 November 2013 - 12:35 PM Rate Topic: -----

#1 dannybarh  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 19-February 11

Search data in db where data is between two dates using sub query

Posted 02 November 2013 - 11:05 AM

$query="SELECT * FROM history WHERE  p_na LIKE '$p_na%' AND svreg LIKE '$svreg%' IN (SELECT  * FROM history WHERE cdate BETWEEN '2013-09-12' AND '2013-12-12')";
$sql=mysql_query("$query");


am searching for data LIKE a and LIKE b that falls between to dates.
I thought a sub query will be the best method, but its not working...

Is This A Good Question/Topic? 0
  • +

Replies To: Search data in db where data is between two dates using sub query

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9479
  • View blog
  • Posts: 35,743
  • Joined: 12-June 08

Re: Search data in db where data is between two dates using sub query

Posted 02 November 2013 - 11:07 AM

Maybe use 'between'?
Was This Post Helpful? 0
  • +
  • -

#3 dannybarh  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 19-February 11

Re: Search data in db where data is between two dates using sub query

Posted 02 November 2013 - 12:25 PM

can you pls give an example of what you saying???
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9479
  • View blog
  • Posts: 35,743
  • Joined: 12-June 08

Re: Search data in db where data is between two dates using sub query

Posted 02 November 2013 - 12:35 PM

How about you try it out first.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1