SQL and Sub queries
This uses a Sub query to insert flat values for a user to see when a user was created and last logged into the system


INSERT INTO #USERLOGGEDIN
SELECT MAIN.USERNAME
,MAIN.NAME
(SELECT top 1 STRINGVALUE FROM USERS_EXTENDED AS CEI WHERE CEI.CLIENTID = MAIN.ID AND CEI.STRINGKEY = 'LASTLOGGEDIN' AND CEI.ACTIVE= 1) AS LASTLOGGEDIN
,(SELECT top 1 STRINGVALUE FROM USERS_EXTENDEDAS CEB WHERE CEB.CLIENTID = MAIN.ID AND CEB.STRINGKEY = 'CREATED' AND CEB.ACTIVE= 1) AS CREATED
FROM USERS AS MAIN
WHERE USERNAME IN (SELECT USERNAME FROM #DUPLICATEDUSER WHERE NUMBER > 1)
Created: 30/08/2016 Total Comment: 0

Comments

(Not Displayed)
Human validation
Enter 2830 number, before submitting to confirm your human
[Home] [All Blogs] [Contact] [Me]