강의

멘토링

커뮤니티

Inflearn Community Q&A

narami4889's profile image
narami4889

asked

Database MSSQL

Supporting materials [PPT, Excel]

sub 쿼리 관련 여러개의 값 저장

Written on

·

336

0

학습내용중 sub 쿼리로 가져오는 값은 단일값이여야 한다고 적혀 있는데 여러게의 값을 가져와서 array에 넣을순 없나요?

select a,b,

(select d from table where id='id') as c

from table

원하는값은

a,b,c[] 이런 형태로 data를 받기 위함입니다.

dbms/rdbmsmssql

Answer 1

0

vmproductor0202님의 프로필 이미지
vmproductor0202
Instructor

안녕하세요.개발자park입니다.

[Q]

a,b,c[] 이런 형태로 data를 받기 위함입니다.

  

[A]

LEFT OUTER JOIN을 사용 후 응용프로그램단에서 array형태로 변환해주시는 것을 추천드립니다.

SELECT a,b,tablec.d

FROM tableab

LEFT OUTER JOIN tablec

ON tableab.컬럼=tablec.컬럼

where tablec.id='id';

JAVA:HashMap타입사용

C#:Dictionary타입사용

for문을 통해 array형태로 변경해주시면 됩니다.

감사합니다.

 

 

 

narami4889's profile image
narami4889

asked

Ask a question