This is a function i have written to demonstrate what i would like to do.
the query is more than likley not accurate as i just wanted to see if someone could tell me