# Help learning and converting Query into LINQ

• ### Question

• I'm trying to learn LINQ. I read a lot of articals for beginners but they were out of my league

please convert these query for me so I might get wats is it about and I'll be very thankfull for that

this one with two values

SELECT name, designation FROM tblEmployee

and this with WHERE

SELECT name, designation FROM tblEmployee
WHERE employeeId=@id

This one with INNER JOIN

SELECT name, tblSalary FROM tblEmployee
INNER JOIN tblSalary ON tblsalary.salaryId=tblEmployee.salaryId

and this one selects the SECOND HIGHEST SALARY

SELECT min(salary) FROM (SELECT TOP 2 salary FROM tblSalary ORDER BY 1 desc)a

• Moved by Wednesday, April 9, 2014 5:00 PM Moved to a more appropriate forum
Wednesday, April 9, 2014 12:49 PM

•  First Query: var result = from p in tblMenu select p; Second Query: var result = from p in tblMenu select p.name, p.designation ; Third Query: var result = from p in tblMenu where p.employeeid = somevariable select p.name, p.designation ; Fourth Query: var result = from p in tblEmployee join p2 in tblSalary on p.salaryId equals p2.salaryId select new { p.name, p2.tblSalaryId}
Wednesday, April 9, 2014 2:01 PM

### All replies

• Edited by Wednesday, April 9, 2014 12:54 PM
Wednesday, April 9, 2014 12:53 PM
• why don't you try yourself by using LINQPad? I am sure you will get a hand of it if you do try using the right tools :)

hope this helps!

Wednesday, April 9, 2014 12:55 PM
• Dear Kalman I'd studied many articles please help me just convert these queries. If possible I might understand that way
Wednesday, April 9, 2014 1:00 PM
•  First Query: var result = from p in tblMenu select p; Second Query: var result = from p in tblMenu select p.name, p.designation ; Third Query: var result = from p in tblMenu where p.employeeid = somevariable select p.name, p.designation ; Fourth Query: var result = from p in tblEmployee join p2 in tblSalary on p.salaryId equals p2.salaryId select new { p.name, p2.tblSalaryId}
Wednesday, April 9, 2014 2:01 PM