MySQL Forums
Forum List  »  Newbie

Re: Adding to query result using UNION
Posted by: Alan Honeyman
Date: June 05, 2021 07:54PM

Yes, I worked it out myself:

SELECT username, logondate, logontime
FROM prodndb.tblUsers
WHERE LogonDate <> ""
UNION
SELECT
'&nbsp' as username, '&nbsp' aslogondate , '&nbsp' as logontime
UNION ALL
SELECT
'&nbsp' as username, '&nbsp' aslogondate , '&nbsp' as logontime
UNION ALL
SELECT
'&nbsp' as username, '&nbsp' aslogondate , '&nbsp' as logontime

The use of "ALL" was the answer. It is needed because I'm adding duplicate keys.

Options: ReplyQuote


Subject
Written By
Posted
Re: Adding to query result using UNION
June 05, 2021 07:54PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.