ASP conditional summing, how ASP conditional summing

Updated on workplace 2024-05-11
16 answers
  1. Anonymous users2024-02-10

    That's not what you mean:

    Table name: price

    Merchandise 1 20

    Merchandise 2 25

    Merchandise 3 50

    Total** 95

    Use a variable to add up each **, for example: n=n+20

  2. Anonymous users2024-02-09

    If you want to sum it, you can use SQL to sum it directly.

    c sl is the field you ask for and the sum of.

    Cart xx is a table.

    CT ID is the condition.

    set rs="")

    sql= "select sum (c_sl) as c_sl from cart_xx where ct_id = " + replace(ct_id, "'", "''") +""

    sql,conn,2,3%>

    rs("c_sl")%>

  3. Anonymous users2024-02-08

    The question is ill-described and does not provide a complete answer.

    1. Data**;

    2. Data structure;

    2. Purpose of the data; (Display?) Write to a table in the database? Is this table existing or does it need to be created? If it's existing, is the data emptied every time it is written, or is it categorized with extra columns? ......

  4. Anonymous users2024-02-07

    Well, this won't work, it's even harder.

    Make sure that the database has an id field (numeric or auto-numbered), and here's how to change it

    id=request("id")

    set rs="")

    sql,conn,1,2

    Then it's up to you to ask for the peace.

    id is in the ty table.

    The id I want is the sum in the jiaban table.

    Another jiaban table? What fields are there?

    The id in ty is the sum of (what field or condition) in the jiaban table?

    I don't know! Sweat!

  5. Anonymous users2024-02-06

    yxz0539

    Correct,But remember not to conflict with the original record set in your web page,It's best to change the name rs to rs1 or rs2 or something.,don't conflict with the original record set rs.。

  6. Anonymous users2024-02-05

    I don't know. Go to the professional ** and ask. I'm sorry.

  7. Anonymous users2024-02-04

    select bigclassname, sum (case bigclassname when 'Technical Articles'then hits else null end) as Total amount of technical articles,sum (case bigclassname when'Company News'then hits else null end) as company news total, sum (case bigclassname when'Corporate culture'then hits else null end) as Total Corporate Culture from News Group by BigClassName

  8. Anonymous users2024-02-03

    select sum(bigclassname) from news where bigclassname like 'Technical Articles'

    select sum(bigclassname) from news where bigclassname like 'Company News'

    select sum(bigclassname) from news where bigclassname like 'Corporate culture'

  9. Anonymous users2024-02-02

    select date 0, sum(amount) as total amount of day from (select amount, cstr(datepart(.)'yyyy', date)) +'-'+cstr(datepart('m', date)) +'-'+cstr(datepart('d', date)) as Date0 from sheet) group by Date0

    On the basis of Songyl525, it has been slightly changed, and the result of access2007 is as follows.

    Date 0--- Total amount.

  10. Anonymous users2024-02-01

    Try it this way:

    sql="select date2, sum(amount) as amount from (select amount, date as date2 from sheet where id=1 or id=2 or id=5).

    group by date 2"

    Or (the same, just replace the ID with the address).

    sql="select Date2,sum(amount) as AmountFrom (select amount,Date as Date2 from sheet where address='Beijing'or address='Shanghai'or address='Nanjing')

    group by date 2"

    It's best to use the first one.,Because the quotation marks of the Chinese characters in asp have requirements.,I've tried it in access.,You can meet your requirements.,I didn't try to convert it to asp.,The landlord solves it himself.。

  11. Anonymous users2024-01-31

    y_date="2008-1-1"(give query date) y year = year (y date).

    y_month=month(y_date)y_day=day(y_date)

    sql="select sum(amount) as total money from sheet where year(date)='"&y_year&"'and month='"&y_month&"'and day ='"&y_day&"'"

  12. Anonymous users2024-01-30

    select date, sum(amount) from (select address, amount, cstr(datepart(.)'yyyy', date)) +'-'+cstr(datepart('m', date)) +'-'+cstr(datepart('d', date)) as Date0 from sheet) group by Date0

  13. Anonymous users2024-01-29

    What type of date is it? If it's a date type:

    select convert(char(6),date,112) as riqi,sum(amount) from sheet group by convert(char(6),date,112).

    If it's a character:

    select left(date,7) as riqi,sum(amount) from sheet group by left(date,7).

  14. Anonymous users2024-01-28

    sql="select sum(field) as total money from table where .Your condition"

    Look at this, I'm looking at other people, too, hehe

  15. Anonymous users2024-01-27

    <%function gettotal()

    dim rs,sql

    sql="select * from sheet where [address] ='Beijing'and [date] ='July'"

    set rs = "")

    sql,conn,1,1

    total = 0

    do while not then

    total = total+rs("Amount")loop

    set rs = nothing

    gettotal = total

    <%= gettotal %>

  16. Anonymous users2024-01-26

    According to the title, asp vbscript should be.

    dim num,x,sum

    num = "10,20,30,40,50"

    sum = 0

    num = split(num,",")

    if isarray(num) then

    for x = 0 to ubound(num)sum = sum + int(num(x))next

    end if

    sum***********************************==

    If the sum of multiple records in the database is used, SQL is used

    select sum(the field) from the table***********************************==

    var num = for js"1,2,3,4,5",sum = 0;

    num = ",");

    for ( var x = 0 ; x < x++

Related questions
5 answers2024-05-11

if condition = 1 then

What is shown in condition 1" >>>More

9 answers2024-05-11

If you're using aspnet, he has a special function in. NET to get a computer name, IP address and current username is very simple, the following are a few methods I commonly use, if you have other good methods, you can reply and sort it out together: >>>More

3 answers2024-05-11

ASP is an abbreviation for ActiveServerPage, which means "Active Server Web Page". ASP is an application developed by Microsoft to replace CGI scripting programs, which can interact with databases and other programs, and is a simple and convenient programming tool. The format of the asp web page file is: >>>More

16 answers2024-05-11

Assumption: The variable passed is tt and the value is "2,9". >>>More

7 answers2024-05-11

The requirements and conditions for joining Didi Express are as follows: >>>More