Search
 
SCRIPT & CODE EXAMPLE
 

SQL

SQL - Row Number into Alphabetical characters

-- ROW NUMBER INTO ALPHABETICAL CHARACTER & CONCAT
WITH updateCode AS (
    SELECT table2.id as typeId, table2.code as typeCode, table1.id as descId, Char(64 + row_number() over (partition by type_id order by table1.id)) as rowLetter
    FROM table1
    INNER JOIN table2 ON table1.type_id = table2.id
)
UPDATE table1
  inner join updateCode on updateCode.descId = table1.id
  set table1.code = CONCAT(typeCode, rowLetter)
  where table1.type_id = typeId;
Comment

PREVIOUS NEXT
Code Example
Sql :: how to order result of subquery in select 
Sql :: edad en oracle 
Sql :: recursive query herarchical data sql server 
Sql :: shortcut run sql pgadmin 
Sql :: mysql set session timeout 
Sql :: sql int +1 
Sql :: naming conventions postgres index 
Sql :: search all tables in a database for a value 
Sql :: mysql set variable in a session 
Sql :: what does the -p flag do in mysql cli 
Sql :: nueva tabla mysql 
Sql :: plus or add balance in postgresql sql 
Sql :: Template MySQL Zabbix agent 
Sql :: mysql create database if not exists 
Sql :: select multiple columns count one column and group by one column in one table 
Sql :: oracle params value 
Sql :: query to fetch 50% records from the table. 
Sql :: Components/Fields of Internal Table 
Sql :: IS THEre any difference between using default and := in plsql 
Sql :: oracle rolling back transactions 
Sql :: mysql pv progres 
Sql :: odoo css not loaded 
Sql :: sqlite timer 
Sql :: opensuse status MySQL 
Sql :: subquery aggregation 
Sql :: postgresql custom order by 
Sql :: Raw into column 
Sql :: mysql update even / odd rows 
Sql :: divide database into structured tables 
Sql :: list column names of multiple tables psql 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =