Friday, December 28, 2012

Embedd Facebook "Like" button to application

Today, we would be discussing how to embedd facebook adhoc 'Like' button in application. It doesn't requires any programming and we would be inserting some ad hoc markup into the Web pages.

So, we can make our website popular by inserting Like button on the page, so that user can click on Like button to make website popular on the Facebook.

So, let's start...

We simply need to insert below code snippet on the web page

 <iframe src="http://www.facebook.com/plugins/like.php?href=XXX" style="border:none; width:450px;height:80px"/>

Replace XXX with your website name

Below is the screenshot for the same:













Hope this article would make you familiar with facebook adhoc buttons.

Tuesday, December 25, 2012

SQL - CrossTab Queries using PIVOT

Today, we would be going through CrossTab queries using the PIVOT function available in SQL.
So let's start....and consider the below scenario

Below is the design of the table













Below is the data present in the table












Now, we want to get data in the manner so that we can see how much money Employee has spent on each travel medium. So, we would be making use of PIVOT here


select EmployeeName,[Train] as Train,[Bus] as Bus
from
(
select EmployeeName,TravelMedium,AmountSpent
from EmployeeExpenses)  ee
PIVOT
(
SUM(AmountSpent)
FOR TravelMedium IN ([Train],[Bus])
) as pvt





Below is the result:













Hope so you get an overview of PIVOT with this.