Thread: String Count

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    133
    Rep Power
    12

    String Count


    Hi,

    Is there something wrong with this statement?

    SELECT COUNT(applod.CAT) AS CATSR FROM applod WHERE applod.CAT LIKE '%SR%'

    This colum has various values such as 1, 2, SR all I want is the number of records that have the value SR in them.

    Also are you able to make calulations to recordsets, for example

    producta = 20
    productb = 30
    productc =40

    ((Sum (producta) + sum (productb) + sum (productc)) / (Sum (productc)))

    to give me a percentage?


    Regards,

    Sanjay
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Melbourne, Australia
    Posts
    212
    Rep Power
    12
    Try the following
    Code:
    <%
    Dim Checkvalue
    CheckValue="SR"
    strquery="SELECT COUNT(applod.CAT) AS CATSR FROM applod WHERE applod.CAT=" & Checkvalue
    %>
    As for the maths on your results, you should be able to write ASP code via loops etc to add up your values, divide them, multiply them etc.

    How can I soar like an eagle when
    I'm flying with turkey's?

IMN logo majestic logo threadwatch logo seochat tools logo