Re: [PHP-DB] php-mySQL and an SQL query

2001-03-08 Thread CC Zona

And even without the subquery, the "like" keyword expects a wildcard 
character or two, for example:

LIKE '$month%' "

> mysql doesn't support sub-queries unfortunately =(
> 
> 
> 
> 
> At 10:22 PM 3/8/01 -0500, Michael Gerholdt wrote:
> >Hi, folks,
> >
> >Can someone insight me regarding this?
> >
> >I have a datetime field in mySQL (-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
> >;
> >$strSQL .= "ORDER BY event_time";
> >echo "$strSQL";
> >
> >$month will be carrying the three-character short version of the alpha month
> >name.

-- 
CC

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] php-mySQL and an SQL query

2001-03-08 Thread Beau Lebens

mysql doesn't support sub-queries unfortunately =(




At 10:22 PM 3/8/01 -0500, Michael Gerholdt wrote:
>Hi, folks,
>
>Can someone insight me regarding this?
>
>I have a datetime field in mySQL (-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";
>
>$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
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
Beau Lebens - Web Master
Insurance My Way, Your Friendly Online Broker
(08) 9226 5888
http://www.insurancemyway.com.au/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]