Concatenation issues

前端 未结 3 1064
后悔当初
后悔当初 2021-01-25 21:07

I have a table \"Patient\" which has 5 fields.

CREATE TABLE PATIENT
(PAT_ID         CHAR (4) PRIMARY KEY,
 PAT_NAME       VARCHAR (7),
 ADMITTED       DATE,
 ROO         


        
3条回答
  •  悲&欢浪女
    2021-01-25 22:05

    It turns out you're actually using Oracle Database. I'm still not sure exactly which fields you're trying to concatenate in which way, but this should be enough to get you rolling:

    CREATE VIEW PATIENT_REPORT 
    AS
    SELECT
      PATIENT.PAT_ID||' '||PATIENT.PAT_NAME as "patient",
      PATIENT.DOCTOR||' '||PATIENT.ROOM||' '||PATIENT.ADMITTED as "details"
    FROM PATIENT;
    

    Here's a live demo on SQL Fiddle.

提交回复
热议问题