Home > database >  I will be two tables to make a view, using the grouping query, how to display the results as shown
I will be two tables to make a view, using the grouping query, how to display the results as shown

Time:11-20

USE (HISC)
GO

/* * * * * * Object: the View [dbo] [TJ_SSFJTJ] Script Date: 11/19/2020 18:07:34 * * * * * */
The SET ANSI_NULLS ON
GO

The SET QUOTED_IDENTIFIER ON
GO





ALTER the view [dbo] [TJ_SSFJTJ]
As
SELECT
BAH=p. atientId,
XM=b.A 11,
XB=CASE WHEN b.A 12 c=1 THEN 'male'
The WHEN b.A 12 c='2' THEN 'female'
END,
NL=b.A 14,
CYRQ=b.B 15,
CYKS=16 n b.B,
SSRQ=s.o p_time,
SSBM=s.c ode,
The SSMC=s.n ame,
YH=CASE WHEN Sheldon horowitz eal_level='1' THEN 'a'
WHEN Sheldon horowitz eal_level='2' THEN 'b'
WHEN Sheldon horowitz eal_level='3' THEN 'c'
WHEN Sheldon horowitz eal_level='4' THEN 'other'
END,
QK=CASE WHEN s. ound_level='1' THEN 'Ⅰ class'
WHEN s. ound_level='2' THEN 'Ⅱ class'
WHEN s. ound_level='3' THEN 'Ⅲ class'
END,
SSJB=s.o p_level,
CYQK=CASE WHEN s. ound_level='1' THEN 'cure'
WHEN s. ound_level='2' THEN 'better'
WHEN s. ound_level='3' THEN 'not'
WHEN s. ound_level='4' THEN 'death'
WHEN s. ound_level='9' THEN 'other'
END,
GZDWJDZ=b.A 29,
ZYFY=f.D 01,
SSYS=s.o p_doctor,
MZFS=CASE WHEN s.a nes_mode='01' THEN 'general anesthesia'
The WHEN s.a nes_mode='0101' THEN 'inhalation anesthesia (endotracheal intubation, laryngeal mask, mask)'
The WHEN s.a nes_mode='0102' THEN 'intravenous anesthesia (all by intravenous anesthesia)'
The WHEN s.a nes_mode='0103' THEN 'static absorption compound anesthesia'
The WHEN s.a nes_mode='0104' THEN 'basic anesthesia (rectal injection and muscle injection)'
The WHEN s.a nes_mode='02' THEN 'regional anesthesia'
The WHEN s.a nes_mode='0201' THEN 'spinal canal anesthesia'
The WHEN s.a nes_mode='020101' THEN 'subarachnoid block'
The WHEN s.a nes_mode='020102' THEN 'epidural space block (contain sacral canal blocking)'
The WHEN s.a nes_mode='020103' THEN 'subarachnoid epidural combined anesthesia -'
The WHEN s.a nes_mode='0202' THEN 'nerve and nerve plexus block'
The WHEN s.a nes_mode='020201' THEN 'cervical plexus block'
The WHEN s.a nes_mode='020202' THEN 'block and upper limb nerve block of brachial plexus'
The WHEN s.a nes_mode='020203' THEN 'lumbosacral plexus block and lower limb nerve block'
The WHEN s.a nes_mode='020204' THEN 'trunk nerve block: intercostals nerve block'
The WHEN s.a nes_mode='020205' THEN 'by the vertebral nerve block'
The WHEN s.a nes_mode='020206' THEN 'perineal nerve block'
The WHEN s.a nes_mode='020207' THEN 'sympathetic nerve block: stellate ganglion block'
The WHEN s.a nes_mode='020208' THEN 'thoracic lumbar sympathetic nerve block'
The WHEN s.a nes_mode='020209' THEN 'brain nerve block: trigeminal nerve block, glossopharyngeal nerve block'
The WHEN s.a nes_mode='03' THEN 'local anesthesia'
The WHEN s.a nes_mode='0301' THEN 'surface anesthesia'
The WHEN s.a nes_mode='0302' THEN 'local infiltration anesthesia'
The WHEN s.a nes_mode='0301' THEN 'surface anesthesia'
The WHEN s.a nes_mode='0303' THEN 'local block anesthesia'
The WHEN s.a nes_mode='0304' THEN 'vein local anesthesia'
The WHEN s.a nes_mode='04' THEN 'acupuncture analgesia and anesthesia'
The WHEN s.a nes_mode='05' THEN 'compound anesthesia'
The WHEN s.a nes_mode='0501' THEN 'acupuncture analgesia and anesthesia'
The WHEN s.a nes_mode='0501' THEN 'different drug compound: composite procaine intravenous general anesthesia, nerve stability and analgesia anesthesia'
The WHEN s.a nes_mode='0502' THEN 'different methods of composite: the static absorption compound anesthesia, needle medicine compound anesthesia, whole body - compound epidural anesthesia, spinal cord - compound epidural anesthesia'
The WHEN s.a nes_mode='0503' THEN 'special methods of compound: general anesthesia compound body temperature (anesthesia) at low temperature, such as controlling step-down'
The WHEN s.a nes_mode='99' THEN 'other'
END
The FROM archives_baseinfo b
LEFT the JOIN archives_operation s
On supachai panitchpakdi atientId=p. atientId
LEFT the JOIN archives_fee f on
F.P atientId=p. atientId WHERE 1=1 and s.n ame!
=' 'Group by b.B 16 n and p. atientId, b.A 11, 12 c, b.A b.A 14, 15, b.B s.o p_time, s.c ode, s.n ame, Sheldon horowitz eal_level, s. ound_level, s.i s_master, s.o p_doctor, s.a nes_mode, 29, b.A f.D 01, s.o p_level



GO

How to make the query result is


Using the FastReport



  • Related