How to replace rows and columns using SQL statements, as shown in question 30

Updated on technology 2024-05-10
15 answers
  1. Anonymous users2024-02-10

    select , from

    select , from test123 t1 where = 'my work') a

    inner join(

    select , from test123 t2 where = 'our work' ) b

    on =inner join(

    select , from test123 t3 where = 'his work' ) c

    on = This is your answer.

  2. Anonymous users2024-02-09

    Your columns are not fixed, you can only use dynamic sql, use cursors.

  3. Anonymous users2024-02-08

    Write a process, and you're done.

  4. Anonymous users2024-02-07

    update table set mc=mc1+'$'+mc2+'$'+mc3+'$';

    Then execute. update table set mc = substring(mc,2,length(mc)-1) where mc like'$%';

    The latter sentence can be executed at most 2 times, that is, if you are afraid that mc1 and mc2 are empty, you can directly fill in $.

  5. Anonymous users2024-02-06

    Columns with no data are null (null) and written like this.

    select mc=isnull(mc1+'$','')+isnull(mc2+'$','')+isnull(mc3+'$','') from tablename

    Otherwise, it should be so.

    select mc=case when mc1>'' then mc1+'$' else '' end,case when mc2>'' then mc2+'$' else '' end,case when mc3>'' then mc3+'$' else '' end

    from tablename

  6. Anonymous users2024-02-05

    Your question is vague.

    Let's say your table looks like this: Data Table Name (Payroll).

    Number, Name, Salary, Bonus.

    1 card three 100 50

    2 Lee 4 150 60

    3 Kings 5 90-40

    4 Zhao 6 200 70

    If you want to replace Li Si's salary with your variable value.

    Define the data source gcn

    dim bianliang 'Your variables.

    dim rs as

    set rs=g_"update pay table set salary='" & bianliang & "'where name='Li Si'")

    If you want to replace the variable with Li Si's salary, this is it:

    dim bianliang 'Your variables.

    dim rs as

    set rs=g_"select Salary from Payroll where name='Li Si'")

    bianliang=

  7. Anonymous users2024-02-04

    decalre @a int

    select @2=id (the column name of the table).

    from the table name.

    where condition.

    Note: Depending on the condition, there should be one value, and multiple worth words replace the result of the last query.

  8. Anonymous users2024-02-03

    update table name.

    set column name = the value you want to replace (in quotation marks if it's a string) (or column name =: your variable).

    where sets the condition (that is, the condition is met to be a good man).

  9. Anonymous users2024-02-02

    Let's assume that the first column in Table 1 is the serial number, the second column is the code, and the first column in Table 2 is the serial number, the second column is the code, and the third column is the name

    update Table 1

    set Table 1Code = Table 2Name.

    where Table 1Code = Table 2Code name.

    Regardless of the ranks

  10. Anonymous users2024-02-01

    Assume that Table 1 is table1 and the fields are id and cid.

    Table 2 is table2 and the fields are id, cid, and cname.

    then update table1 set = where =

  11. Anonymous users2024-01-31

    update Table 1 Set ABCD field = (select name from Table 2 where table field = table field).

  12. Anonymous users2024-01-30

    update set a.Letter column = bChinese character column from Table 1 a, Table 2 b where aLetter column = bLetter columns.

  13. Anonymous users2024-01-29

    select * from arctype case when topid=0 then topid else reid end;

    Don't know what database you are, I'm writing sqlserver

  14. Anonymous users2024-01-28

    It's a trifle. update your table set Columns to replace =replace (Columns to replace,'dedecms','t775

    where article id between 1 and 200

    If you have any problems in the future, I will try to solve them for you as quickly as possible.

  15. Anonymous users2024-01-27

    If your keyword is in a field, that's fine.

    update table set field name ='t775'where id<=200 and fieldname='dedecms'

Related questions
13 answers2024-05-10

Convert nvarchar to decimal and then float, e.g

declare @vnum varchar(20) >>>More

7 answers2024-05-10

No, you can only display data in a field that is bound to a data table.

25 answers2024-05-10

dim xlbook as

dim xlsheet as >>>More

18 answers2024-05-10

Filter out the same data as column A in Sheet1 and Column A in Sheet2 and automatically modify the background highlighting? First, use the formula to import column A in sheet2 into any empty column in sheet1 (for example, aa in sheet1 is an empty column), and enter the formula =sheet2!a1 pulls down to fill. >>>More

7 answers2024-05-10

1. Open the settings interface and select "Devices".

2. Click the "+" button on the left side of "Add Printer or Scanner"; >>>More