Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
| Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 19th, 2005, 12:18 PM
TC TC is offline
Registered User
Join Date: May 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Joining name/value data to flat data


I have 2 tables, tblAccount and tblAttribute. tblAccount is a 1 row per user affair, whereas tblAttribute is a name/value table. What I need to do is to combine all the data into a 1 row per user query. Something like:

SELECT tblAccount .*,
tblAttribute.Value AS EmploymentOccupation WHERE tblAttribute.Name='EmploymentOccupation',
tblAttribute.Value AS EmploymentStatus WHERE tblAttribute.Name='EmploymentStatus'
FROM tblAccount
INNER JOIN tblAttribute ON tblAccount.ID = tblAttribute.ID

I know this isn't the way to do this, but any pointers gratefully received.


Old May 19th, 2005, 12:25 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi

hi there.. maybe you can post an example.. that will be better to understand what are you trying to achieve...



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to export Data from MySql to flat file. SkyMouse XML 2 August 19th, 2008 03:04 PM
Export Mysql data to Flat file using .Net 2.0 SkyMouse .NET Framework 2.0 0 August 18th, 2008 11:36 PM
Joining data from multiple data sources ClaesR BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 0 August 28th, 2006 09:30 AM
How to make hierarchical data "lay flat" using SQL tinlong SQL Language 1 August 1st, 2003 01:38 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.