Something wrong with my query, what am I doing wrong?

There is something wrong with my query, what am I doing wrong?
select	mmatter, mdesc1, 
		tklast + ', ' + tkfirst + ' (' + tkinit + ')' as WA,
		sum(hwacur) as MTD_Billable_hours,
		sum(hwaytd) as YTD_Billable_hours
from df_dwtkmat , df_dwcontrol, matter, timekeep
where matter in (select	distinct  mmatter from timecard
					where ttk='02500'
					and tworkdt between getdate()-30 and getdate())
and rectype=4020
and defvalue=pe
and matter=mmatter
and watty=tkinit
group by mmatter, mdesc1, 
		tklast + ', ' + tkfirst + ' (' + tkinit + ')'
having sum(hwacur) <> 0 or
		sum(hwaytd)<> 0
order by 		mmatter, mdesc1, 
		tklast + ', ' + tkfirst + ' (' + tkinit + ')'

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Well, to be honest with you, we don't know unless you tell us.
What is the error message you're getting?
Scott PletcherSenior DBACommented:
It's literally impossible for us to tell which column comes from which table.

You need to specify an alias for every table in the query and prefix every column with a table alias.

Then we'd have a chance of determining what might be wrong / missing.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.