php mySQL SQL question
by "Michael Gerholdt" <gerholdt(at)fredonia.edu>
|
Date: |
Thu, 8 Mar 2001 22:07:28 -0500 |
To: |
"hwg-languages" <hwg-languages(at)hwg.org> |
|
todo: View
Thread,
Original
|
|
Hi, folks,
Can someone insight me regarding this?
I have a datetime field in mySQL (yyyy-mm-dd hh:mm:ss) called event_time
I want to pull records hitting against this field with the idea:
where the abbreviated month from this field LIKE '$month'
and here's the SQL string I've been playing with. It works when I comment
out the line that tries to do the above with a subquery.
$strSQL = "SELECT DATE_FORMAT(event_time, '%M %e %Y, %l:%i %p'), bandname,
image ";
$strSQL .= "FROM doings, styles ";
$strSQL .= "WHERE style = musicstyle ";
$strSQL .= "AND bandname LIKE '$artist' ";
$strSQL .= "AND style LIKE '$style' ";
$strSQL .= "AND (SELECT DATE_FORMAT(event_time, '%b') FROM doings) LIKE
'$month' ";
$strSQL .= "ORDER BY event_time";
echo "$strSQL<BR>";
$month will be carrying the three-character short version of the alpha month
name.
I don't think it likes my subquery, though I like it just fine.
Regards,
Michael Gerholdt
SUNY College at Fredonia
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA