Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 query experssion

Author  Topic 

desikankannan
Posting Yak Master

152 Posts

Posted - 2010-01-31 : 03:51:31
Hi,
i try to get subquriers below and if i remove the t.itemcode='266' then shows all the item ,i wants to get particular item for that iam using t.itemcode='266'
it shows the error joint expression not supported

Select T.ShortCode,T.ItemName,T.ItemRate,T.OpenBal,IIf(IsNUll(Sum(P.Quantity)),0,Sum(P.Quantity)) As Inward,0 As Outward,T.ItemCode from ITEMMASTER AS T LEFT JOIN (PURCHDETAIL AS P LEFT JOIN PURCHASE AS R ON (R.PURCHCODE=P.PURCHCODE AND R.PurchDate <= #31-Jan-10#)) ON P.ITEMCODE=T.ITEMCODE AND T.ITEMCODE ='266'
Group By T.ShortCode,T.ItemName,T.ItemRate,T.OpenBal,T.ItemCode

Desikankannan

Kristen
Test

22859 Posts

Posted - 2010-01-31 : 05:10:49
Move T.ITEMCODE ='266' to a WHERE clause - it doesn't have anything to do with the JOIN'd tables (although it isn't syntactically wrong)

Is this SQL Server 2005?

IIf() is not valid syntax nor is #31-Jan-10# - looks more like Access to me.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-02-01 : 01:31:42
If the above suggestion doesn't work, post your question at MS ACCESS forum

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -