Link to home
Start Free TrialLog in
Avatar of soozh
soozhFlag for Sweden

asked on

tsql syntax

Hello,


I have a table that has patient-id, visit year, plus some other columns....

It is possible to write some sql that produces a simple frequency table that shows me year and number of visits for each patient?

I am particularly interested in seeing which years the patient did not make any visit, but also need to see how many visits per year in the other years.  i.e. i dont want to exclude the years the patients did not visit.

Also if it is possible I would like to go a step further an see the distribution of the number of visits.  What i mean by this is I would like to see for each year how many patients made zero visits, how many one, how many two, how many three etc.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of devlab2012
devlab2012
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sharath S
Do you have fixed no. of years?
Do you want the result pivoted as mentioned above?
Avatar of soozh

ASKER

i dont know which years they are... i hoped that the years could be taken from the data.
Can you provide some sample data with expected result?
Avatar of soozh

ASKER

Not exactly the solution i wanted... but it worked..