Create TableK_user (op_idVARCHAR( $) not NULL, Op_nameVARCHAR( -) not NULL, PasswordVARCHAR( -) not NULL, Real_nameVARCHAR( -) not NULL, Lock_markVARCHAR( -) not NULL, Dept_noTEXT NULL, post_idTEXT NULL, TelVARCHAR( -)NULL, MailVARCHAR( -)NULL, create_idVARCHAR( $) not NULL, Create_nameVARCHAR( -) not NULL, Create_timeVARCHAR( -) not NULL, modify_idVARCHAR( $)NULL, Modify_nameVARCHAR( -)NULL, Modify_timeVARCHAR( -)NULL, RemarkVARCHAR(1024x768)NULL, constraintPk_k_userPrimary Key(op_id));
create table K_user_role ( user_id varchar (not
null varchar (not
null , constraint Pk_k_user_role primary key (user_id
Create TableK_role (op_idVARCHAR( $) not NULL, Op_nameVARCHAR( -) not NULL, create_idVARCHAR( $) not NULL, Create_nameVARCHAR( -) not NULL, Create_timeVARCHAR( -) not NULL, modify_idVARCHAR( $)NULL, Modify_nameVARCHAR( -)NULL, Modify_timeVARCHAR( -)NULL, RemarkVARCHAR(1024x768)NULL, constraintPk_k_rolePrimary Key(op_id));
SELECT * FROM (select u.*, array_to_string (Array (select role_id from k_user_role ur WHERE ur.user_id = u.op_id), ', ') as User_role, array_to_string (Array (SELECT op_name from K_user_role ur,k_role R WHERE ur.role_id=r.op_id an D ur.user_id = u.op_id), ', ') as role_name from K_user u) k_user limit offset 0
PostgreSQL row to column, stitching string