?
Solved

SQL Server Query

Posted on 2011-09-05
3
Medium Priority
?
203 Views
Last Modified: 2012-08-14
Can any one explain following query?

SELECT 
	vchDeviceID[DeviceID],
	DeviceName[DeviceName],
	tblDevices.DeviceID[ID], 
	CustomerID[custId], 
	tblDevices.IsActive, 
	ColorCode,  
	dbo.GetLastCustomerLongitude(tblDevices.DeviceID) as Longitude,  
	dbo.GetLastCustomerLatitude(tblDevices.DeviceID) as Latitude ,
	tblSubscription.isActive as IsPaid 
FROM 
	tblDevices  
	inner join tblSubscription on tblDevices.DeviceID = tblSubscription.intDeviceID  WHERE tblDevices.DeviceID = @intID

Open in new window


- Deepak Lakkad
0
Comment
Question by:Deepak Lakkad
3 Comments
 
LVL 16

Accepted Solution

by:
Easwaran Paramasivam earned 2000 total points
ID: 36486731
It joins two table tblDevices  and  tblSubscription based on the given condition. It means that, the condition satisfied items from 2 table records are given as result.
Where condition is used to filter the result further. The name within [] is just alias name. dbo.GetLastCustomerLongitude(tblDevices.DeviceID) is user defined function. That function should be exist in the DB. The result is shown in result set.

sp_helptext  GetLastCustomerLongitude will give the function in text.
0
 
LVL 11

Author Closing Comment

by:Deepak Lakkad
ID: 36486773
Thank your very much
0
 
LVL 42

Expert Comment

by:dqmq
ID: 36486782
It returns information for a specific device and it's subscription statuses, provided it has one or more subscriptions.  
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question