tecdesign Posted March 6, 2007 Share Posted March 6, 2007 I tried the following mysql query and it is not working $result = mysql_query("select * from $bank where username = '$username' ORDER BY $order DESC HAVING date_stamp >= $from AND date_stamp <= $to"); Any Suggestions Quote Link to comment https://forums.phpfreaks.com/topic/41489-having-clause-date/ Share on other sites More sharing options...
artacus Posted March 6, 2007 Share Posted March 6, 2007 1) easier to read if you use between and you need to quote your dates, 2) don't store each $bank in its own table, store them all in 1 table with a bank field. 3) Can't use HAVING unless there is a group by clause, SELECT * FROM banks WHERE bank_name = '$bank' AND username = '$username' AND date_stamp BETWEEN '$to' AND '$from' ORDER BY $order DESC Quote Link to comment https://forums.phpfreaks.com/topic/41489-having-clause-date/#findComment-200984 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.