Multi or Single Record using SQL
Hello All Master,
I have a question how to display multi or single record note using SQL effectively?
CREATE TABLE ZZZZ
(DOCNBR VARCHAR(255), ZN VARCHAR(255)
);
INSERT INTO ZZZZ VALUES ('138200806', 'A');
INSERT INTO ZZZZ VALUES ('138200807', 'C');
INSERT INTO ZZZZ VALUES ('138200807', 'C');
INSERT INTO ZZZZ VALUES ('138200808', 'B');
INSERT INTO ZZZZ VALUES ('138200808', 'B');
INSERT INTO ZZZZ VALUES ('138200808', 'D');
INSERT INTO ZZZZ VALUES ('138200808', 'C');
if DOCNBR having multiple ZN then return SINGLE else MULTI group by DOCNBR.
Like 138200807, even it has more than 1 record, query should return single because it only have 1 ZN