Hi Nagarajan,
So - this is what I have ended up with (correct me if incorrect):
SQLCMD -S <servername> -d <db_name> -U sa -P <password> -Q "set nocount on;SELECT T0.ItemCode,T0.FrgnName, T0.U_Brand,
(SELECT distinct(T0.[ItemCode]), T0.[ItemName],case when T1.[PriceList] = '01' then T1.[Price] end as Price1, case when T1.[PriceList] = '02' then T1.[Price] end as Price2 FROM OITM T0 INNER JOIN ITM1 T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITW T2 ON T0.ItemCode = T2.ItemCode WHERE T2.[WhsCode] = '01'), T0.CodeBars, CASE WHEN T2.OnHand - T2.IsCommited > 10 THEN 'Y' ELSE 'N' END FROM OITM T0 inner join ITM1 T1 on T0.ItemCode = T1.ItemCode and T1.[PriceList] = '2' inner join OITW T2 on T0.ItemCode = T2.ItemCode and T2.WhsCode = '01. Main'" -s "," -o "\\test\test.csv" -h-1 -s"~" -W -w 999
Regards
Rick