Monday, March 26, 2012

Query

Hi,
I have an Audit table that has the following fields and values
FieldName ChangedValue
FirstName Scott
LastName Hello
how am i able to create a query to show the above in one line
FirstName LastName
Scott Hello
Thanks
EdHi
Unless you can identify how to pair your records then you may get spurious
results
If say there was an identifier column (called id) you can link using that
SELECT a.ChangedValue as [Firstname], b.ChangedValue as [LastName]
FROM dbo.MyAudit A
JOIN dbo.MyAudit B on A.id = B.Id
WHERE a.FieldName = 'FirstName'
b.FieldName = 'LastName'
This previous post may also help:
http://tinyurl.com/6rhsj
John
"Ed" wrote:

> Hi,
> I have an Audit table that has the following fields and values
> FieldName ChangedValue
> FirstName Scott
> LastName Hello
> how am i able to create a query to show the above in one line
> FirstName LastName
> Scott Hello
> Thanks
> Ed
>
>

No comments:

Post a Comment