You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Nicki Møller <ni...@yahoo.dk> on 2000/07/23 21:13:35 UTC

Wildcard in a SQL-query??

Hi All,

Can anyone help me with making a query containing a
wildcard. (something similar to this)

WHERE day% like Starttime

I've tried different wayes of dooing this but with out
luck.

Here's to examples on what I've tried


--------------
<xsp:logic>
String day = request.getParameter ("day");
day.trim();
</xsp:logic>

 <query connection="foo_connection">
	SELECT Event_Id, Body, Starttime, Endtime FROM Events
WHERE <xsp:expr>day</xsp:expr>% like Starttime 
ORDER BY Event_Id  
 </query>
--------------

--------------
<xsp:logic>
String day = request.getParameter ("day");
day = day + "%"
day.trim();
</xsp:logic>

 <query connection="foo_connection">
	SELECT Event_Id, Body, Starttime, Endtime FROM Events
WHERE <xsp:expr>day</xsp:expr> like Starttime 
ORDER BY Event_Id  
 </query>
--------------

All help is appreciated 

-Nicki

______________________________________________________
Do You Yahoo!?
Få en gratis @yahoo.dk-adresse på http://mail.yahoo.dk

Re: Wildcard in a SQL-query??

Posted by Geoff Drake <ge...@attglobal.net>.
Hi Nick the usual syntax is:

select somefields from aTable
WHERE name like 'SMITH%'

Note the ' around SMITH%
Also like only works for text/char fields e.g. varchar.

Hope this helps

Geoff




Nicki Møller wrote:

> Hi All,
>
> Can anyone help me with making a query containing a
> wildcard. (something similar to this)
>
> WHERE day% like Starttime
>
> I've tried different wayes of dooing this but with out
> luck.
>
> Here's to examples on what I've tried
>
> --------------
> <xsp:logic>
> String day = request.getParameter ("day");
> day.trim();
> </xsp:logic>
>
>  <query connection="foo_connection">
>         SELECT Event_Id, Body, Starttime, Endtime FROM Events
> WHERE <xsp:expr>day</xsp:expr>% like Starttime
> ORDER BY Event_Id
>  </query>
> --------------
>
> --------------
> <xsp:logic>
> String day = request.getParameter ("day");
> day = day + "%"
> day.trim();
> </xsp:logic>
>
>  <query connection="foo_connection">
>         SELECT Event_Id, Body, Starttime, Endtime FROM Events
> WHERE <xsp:expr>day</xsp:expr> like Starttime
> ORDER BY Event_Id
>  </query>
> --------------
>
> All help is appreciated
>
> -Nicki
>
> ______________________________________________________
> Do You Yahoo!?
> Få en gratis @yahoo.dk-adresse på http://mail.yahoo.dk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org