0

Dear All !
Please Correct my SQL String.

        sqlcmd = New SqlCommand("Select top 10 Distinct[Batch No], [Item Name],Decentralization, UOM, Balance from Decentralization order by Serial desc", conn)

When I run this Command I get Following error : incorrect syntax near the keyword 'Distinct'

2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by Pgmer
0

Select Distinct top 10 [Batch No], [Item Name],Decentralization, UOM, Balance from Decentralization order by Serial desc
Distinct should come first before top 10...

0

Dear Sir;
I want Top 1 record for each Item Name, Batch No & Department. What sql code should i give ?
output1

0

Use group by... Somthing like this
Select distinct ItemName,BatchNo,UOM,Department
from URTABLENAME group by ItemName,BatchNo,UOM,Department.
Include all the column in select and gropu by

Edited by Pgmer

0

Dear Sir !
My Database is : -
output3

**From this I want this Filtured Result :- **

Desigred_Result

Please Write a code for this result.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.