원본 사용자의 데이터를 거의 복제하는 뷰를 만들고 있지만 사용자가 가지고있는 항목의 수를 넣으려는 특성도 있습니다. 다운로드 테이블. num_streams
필드에where 절의 결과를 기반으로 별칭 만들기
SELECT COUNT(ods_streaming.sid_customer)
WHERE ods_streaming.sid_customer = md_customer.sid_customer
: 내가 원하는 무엇
CREATE VIEW customer_count_streams_vw(
sid_customer
systemuser_id
postcode
age
gender
num_streams)
AS
SELECT
user.sid_customer,
user.systemuser_id,
user.postcode,
user.age,
user.gender,
num_streams
FROM md_customer
INNER JOIN ods_streaming AS num_streams (
SELECT COUNT(ods_streaming.sid_customer)
WHERE ods_streaming.sid_customer = md_customer.sid_customer)
은 부품의 결과를 배치하는 것입니다.
'USER'는 대부분의 데이터베이스 엔진에서 예약어입니다. –
고맙습니다. 이것은 코드 초안 일 뿐이므로 결국 코드를 실행하면 코드가 변경됩니다. – olovholm