How to retrive Text Collomns in group by Close

  • Hi,

    i am Developing one query which will retrive the data from SQl 2005.

    i am using Self join and Group By Close in query it supports for numeric field and Date but not to retrive the Text fileds from database can any one help for me.

    Select T1.DocEntry "Vch. No",sum(T1.Serial)"Serial No", T1.DocDate "Date", Sum(T2.Quantity)"Quantiry",Sum (T1.DocTotal)"Goss Toal",Sum(T2.LineTotal)"Net Sale", Sum (T3.TaxSum)"Excise", Sum (T4.TaxSum)"ECess",Sum (T5.TaxSum)"HECess",Sum(T6.TaxSum)"VAT",Sum(T1.DiscSum) "Round Of", Sum(T1.TotalExpns)"Octroi/Fraight/Others" from ODLN T1, DLN1 T2, DLN4 T3,DLN4 T4,DLN4 T5,DLN4 T6 where T3.StaCode = 'Excise'and T4.StaCode = 'Cess' and T5.StaCode = 'SHCess' and T6.StaCode = 'VAT4'and T1.DocEntry = T2.DocEntry and T1.DocEntry = T3.DocEntry and T1.DocEntry = T4.DocEntry and T1.DocEntry = T5.DocEntry and T1.DocEntry = T6.DocEntry group by T1.DocEntry, T1.DocDate, T3.DocEntry, T4.DocEntry, T5.DocEntry, T6.DocEntry Order By T1.DocEntry

    i would like add another one filed that is T1.Name after T1.DocDate that should be retrive from same table

  • Try MAX(Cast(textfield as varchar(max))

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply