RE: FN-FORUM: One for the SQL Experts
date posted 10th September 2007 22:58
Thanks Paul,
But I think that would fail if the numbers were 2,5,22,222,234 and were
looking for LIKE 2.
Craig
-----Original Message-----
As you might know from my posts I'm no SQL expert, but try:
strSQL = "SELECT COUNT(mailingListID) AS recount FROM tblMailingList
WHERE IsNull(unsubscribe) AND domainReg = '" & strDomain & "' AND
mailingGroupID LIKE '" & myVar & "';"
hth
Paul
On 10 Sep 2007 21:38:48 -0000, Craig [EMAIL REMOVED] wrote:
>
> Hi,
>
> I'm trying to build a query in classic ASP to fire against a MySQL 5.0
> server that can look inside a field value.
>
> So far I have:-
> strSQL = "SELECT COUNT(mailingListID) AS recount FROM tblMailingList WHERE
> IsNull(unsubscribe) AND domainReg = '" & strDomain & "'"
>
> There is a tblMailingList.mailingGroupID field that has recently been
> converted to hold a comma delimited list of mailingGroupID's. I need to
add
> something to this query to say "AND the supplied number exists in
> mailingGroupID" but in SQL of course. In other words, if the
mailingGroupID
> field holds: 5,2,6,8,2 and the supplied number is 2 then I want it
included
> in the count.
>
> Would this be a sub-query, can it be done, am I going about it all the
wrong
> way?
>
> Any advice gratefully received.
>
> Craig
>
>
>
>
> --
> Freelancers, contractors earn more with Prosperity4
> Call 0870 870 4414 or visit www.prosperity4.com
> and benefit from Inland Revenue approved expenses today.
>
> To advertise here: http://www.freelancers.net/advertising.html
>
>
--
Freelancers, contractors earn more with Prosperity4
Call 0870 870 4414 or visit www.prosperity4.com
and benefit from Inland Revenue approved expenses today.
To advertise here: http://www.freelancers.net/advertising.html