Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem in Query

Status
Not open for further replies.

prakash2000

Technical User
Oct 23, 2009
8
0
0
IN
Dear All,

Every week im preparing weekly report based on the following query. last one month its worked properly but this week its not working.

my DB fidld "DateTime" Varchar type.it capture following format date and times "January 31, 2010, 1:50:05 pm"


$sqlQuery="SELECT Center,count(*)as rec FROM res_DB where DateTime BETWEEN '".$st_date."%' and '".$sto_date."%' GROUP BY Center";

details
-------
st_date - starting week date
sto_date - End of the week


pl. help me where is the problem.


thanks in advance.
prakash

 
the problem is here --

my DB fidld "DateTime" Varchar type

change this to DATETIME type

(also, pick a better column name than "DateTime")

r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
Hi r937,
Thanks for ur reply, i tryed type changing option locally (varchar into DateTime format)after convert my data and times r lost. its shows 0000-00-00 00:00:00 what can i do pl. help me. so for im having more then 700 rows in different date and time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top