November 16, 2010 at 9:29 am
I have following table in my database
Brand Model Category ColorCode URL
Alain Mikli 800 Sunglasses Bluehttp://www.800.com
Burberry 900 Eyeglasses Black http://www.900.com
Bvlgari 500 Sunglasses Yellow http://www.500.com
And I want to write a select query which would display data in resultset as
Brand URL
Alain Mikli http://www.800.com
Sunglasses http://www.800.com
Blue http://www.800.com
Burberry http://www.900.com
Eyeglasses http://www.900.com
Black http://www.900.com
Bvlgari http://www.500.com
Sunglasses http://www.500.com
Yellow http://www.500.com
can anybody please help me with this !!
November 16, 2010 at 9:36 am
Hi Biren,
Something like
SELECT Brand,URL FROM Table
UNION
SELECT Model,URL FROM Table
UNION
SELECT Category,URL FROM Table
UNION
SELECT ColorCode,URL FROM Table
should do it. Are you concerned about the order of records?
November 16, 2010 at 9:39 am
Hi,
I have attached an attachment, which would be easy to explain me how i want the data.
Thank You
November 16, 2010 at 10:22 am
In addition to what Joe has posted, please refer to the article in my signature line for assistance on creating a post with proper examples and sample data. Following these guidelines will make helping you much easier and faster.....help us help you.
November 16, 2010 at 11:46 am
If looks as if you need a grouped report similar to this
BrandURL
Alain Mikli http://www.800.com
•Sunglasseshttp://www.800.com
•Bluehttp://www.800.com
Burberry http://www.900.com
•Eyeglasseshttp://www.900.com
•Blackhttp://www.900.com
Bvlgarihttp://www.500.com
•Sunglasseshttp://www.500.com
•Yellowhttp://www.500.com
You can do this with a Common Table Expression (CTE)
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply