Friday, 22 November 2013

Difference Between LINQ and SQL Select with Order by Query  Syntax.


The select statement is used in SQL to specify what data you would like returned when querying the MSSQL MYSQL LINQ database. An asterisks [*] will return all data, or you can choose specific data.

The ORDER BY keyword is used to sort the result-set by one or more columns in View Table and SP.
The ORDER BY keyword sorts the records in ascending order by default. To sort the records in a descending order, you can use the DESC keyword.


SQL : select(clause) * from (clause) from <table Name> where(clause) column =value order by
          column name desc

           select * from customer where id =100  order by created_date desc

LINQ : from <instance> in <table name or table object name> where (clause) column=value
          orderby(clause) columnName asc   select <instance>

           from cust in customer where cust.id. Equuleus (100) orderby cust.created_date desc
           select cust; 


 

No comments:

Post a Comment