creating view with user variable
From: David <david.greenhall_at_gmail.com>
Date: Mon, 23 Jan 2017 09:50:42 -0800 (PST)
Message-ID: <58e7cbe9-de29-4aea-8002-c89fe390bbf9_at_googlegroups.com>
[Quoted] Hi guys,
Date: Mon, 23 Jan 2017 09:50:42 -0800 (PST)
Message-ID: <58e7cbe9-de29-4aea-8002-c89fe390bbf9_at_googlegroups.com>
[Quoted] Hi guys,
[Quoted] Can anyone tell me if its possible to create a view with a where clause linking to a variable which is passed by the user.
Something like:
CREATE VIEW test As
SELECT * FROM userAccount
LEFT JOIN userDetails On userAccount.ID = userDetails.UID
WHERE userAccount.ID = {variable}
Then in the user accesible pages, it would be called by
SELECT * FROM test WHERE (but here is where I get stuck)
I have found a few articles knocking around which suggest creating a function and then calling the function by the user instead of calling the view , but all examples I tried this always through up errors.
Would be most grateful if someone could point me in the right direction.
Dave. Received on Mon Jan 23 2017 - 18:50:42 CET