My table has one record per employee per year. What should be the query to change visibility if employee data is not recorded this year.
Column names are employee_name
, employee_Id
, rating
, CreatedOn
where CreatedOn
is basically timestamp.
Suppose there are two forms, form1
and form2
and its visibility depends on the user input. If user has submitted form1
, he can only see form2
. Exactly after a year, respective user can see the form1
again.
I tried the following command, but is not working
SELECT COUNT(*) FROM
TABLE
WHERE employee_Id = '$CurrentUserId$'
AND CreatedOn > DATEADD(year,-1,GETDATE())
if query = 0
, show form1
, else show form2
I know basic SQL, but my skills are not upto this level.