Skip to content

Tag: sql-server

Performance for Avg & Max in SQL

I want to decrease the query execution time for the following query. This query is taking around 1 min 20 secs for about 2k records. Numbers of records in table: 1348474 Number of records processed through where query: 25000 Number of records returned: 2152 I tried removing the AVG & MAX columns and it lo…

Reformatting SQL output

I have data that looks like this Name XX YY alpha 10 77 beta 10 90 alpha 20 72 beta 20 91 alpha 30 75 beta 30 94 alpha 40 76 beta 40 95 If I use select * from scores order by Name, XX I will …

Getting the personal contact details of an employee

I want to get the Email, Phone and Mobile number of each employee. The ContactDetailsType contains the Label which is email,phone,fax… and ContactDetails contains the ContactDetailsTypeId (the ID of ContactDetailsType) and the Info having the value of the phone number (for example). I tried the followin…