SQL statement to return multiple values of a field to multiple fields

Updated on technology 2024-06-09
14 answers
  1. Anonymous users2024-02-11

    Do you assign this value in SQL, or in delphi or c.

  2. Anonymous users2024-02-10

    4 rows become 1 row?

    If you're using SQL Server, you can do it in a weird way:

    select

    distinct ',sale_item

    from sale_report

    for xml path(''

    The landlord can test it and finally use a for xml path(''That's it.

    The result of my SQL execution above is:

    c,a,b

  3. Anonymous users2024-02-09

    This is a row column or something, you can refer to decode.

    If you don't need a SQL implementation, you can use the cursor cursor to query and then summarize the result set you want. Can.

  4. Anonymous users2024-02-08

    4 rows become 1 row?

    If you're using SQL Server, you can do it in a weird way:

    select

    distinct ',' + sale_itemfrom

    sale_report

    for xml path('')

    The landlord can test it and finally use a for xml path(''That's it.

    The result of my SQL execution above is:

    c,a,b

  5. Anonymous users2024-02-07

    update b set x = case when >= then 'yes' else 'no' end

    from a , b

    where (here add the condition of the corresponding record in tables A and B, such as =, otherwise there is no condition update error.) )

  6. Anonymous users2024-02-06

    This first requires a field that is uniquely associated with tables A and B, assuming the field name: idselect b* case when > then 'yes' else 'no' end as x

    from b , a

    where =

  7. Anonymous users2024-02-05

    What is the relationship between table A and b, and are there any related fields? Or is there only one row of value per table?

  8. Anonymous users2024-02-04

    That's what you mean, right? Let's say "another table" is a and the field to be inserted is, then:

    update a

    set a|b|c from ..where ..where a...

  9. Anonymous users2024-02-03

    Don't understand what you mean?

    If you combine multiple fields in a record into one value, set up a tablea field a, b, and c; Table tableb, field dtablea

    a b ci hate you

    I want to insert a tableb table like this.

    tableb:

    di hate you

    That's it: insert into tableb(d)select a||b||c from tablea

    If you combine multiple records into one.

    You'll have to use a stored procedure.

  10. Anonymous users2024-02-02

    insert into Table 1 (Field) select [field a] from [Table 2] where [id] = 1 union select [field b] from [Table 2] where [id] = 1 union select [field c] from [Table 2] where [id] = 1

  11. Anonymous users2024-02-01

    Use id to make an internal connection between the two tables, and use cast() to convert int to varchar().

    select ,from table1 t1 inner join table2 t2

    on cast( as varchar(8))=;

  12. Anonymous users2024-01-31

    if object_id('table1') is not null

    begindrop table table1

    endgocreate table table1 (a int ,b int)goinsert into table1

    select 1,1

    unionselect 1,2

    unionselect 1,3

    unionselect 2,1

    goselect a.* from table1 a where exists(select * from table1 b where and <>

    - Remember to adopt it in time, the task is not completed today, and there is only one left.

  13. Anonymous users2024-01-30

    Onlookers, it's actually very simple.

  14. Anonymous users2024-01-29

    The first thing you need to do is determine which field it is.

    For example, the values in field A and field B are all abc

    select * from the table name.

    where field a='abc'and field b='abc'

Related questions
15 answers2024-06-09

select , from

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

5 answers2024-06-09

F get domain contrast is a formatting function (should be written by yourself), the first parameter (arg prod spec id) according to the second parameter (120) formatting and return the result to the v bill code, according to the function naming method, the above ** should be the standard format for getting the date.

5 answers2024-06-09

With a view or an index.

create index >>>More

8 answers2024-06-09

update table name set a=stuff(a,3,2,'22'Where a in(select top 5 a from table name) is good to replace with stuff, there are 4 parameters in it, field name, first few characters, replace a few, replace what.

4 answers2024-06-09

Oracle does not have SQL statement backup, only exp export or RMAN backup, are not SQL, RMAN is a standard block backup, the premise is that the database must be archived, and then RMAN backup can be carried out, this method can be used for databases with a large amount of data, the speed will be relatively fast, the specific method can be checked from the Internet, it is not very difficult, but it is more cumbersome, there is an exp export, this is to directly export the table in the database to the city dmp file, The specific syntax is: >>>More