SQL Cast

Per reaiazzare il cast di un campo in SQL si possono seguire questi esempi

esemio di cast in una select questi

SELECT itemdid, cast( codenumber as varchar(10)), mysubject
FROM mytable

Esemio di cast in una JOIN

SELECT *
FROM mytable mt
LEFT JOIN myothertable ot
    on cast(mt.codenumber as varchar(10)) = ot.number_code 

.
Postgresql cast in select query  -> cast bigint to int

select "MenuParent", cast(count("ModuleID") as integer ) 
from menu
GROUP BY "MenuParent", "ModuleID"
ORDER BY "MenuParent" ;

Risorse:

—–
Annunci