[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Creating a View ERROR:  column "name" specified more than once

Posted on 2008-06-18
2
Medium Priority
?
3,595 Views
Last Modified: 2010-04-21
I'm trying to create a view in postgresql so that my Zen dFramework app can query it.

I get the following error

ERROR:  column "name" specified more than once

I'm not quite sure what my options are to fix the problem.





CREATE VIEW "v_itemshort" AS SELECT "public"."t_item_types"."name",
 "public"."t_items"."id", "public"."t_items"."serial", "public"."t_items"."nickname",
 "public"."t_sites"."name", "public"."t_status"."name"
 
 FROM "public"."t_items" INNER JOIN "public"."t_status"
 
 ON ("public"."t_items"."status_id" = "public"."t_status"."id")
 
 INNER JOIN "public"."t_sites"
 
 ON ("public"."t_items"."site_id" = "public"."t_sites"."id")
 
 INNER JOIN "public"."t_item_types" ON ("public"."t_items"."type_id" = "public"."t_item_types"."id")

Open in new window

0
Comment
Question by:sean-keys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
jagmohan_gunwant earned 1000 total points
ID: 21815009
Hello Friend
The Error is Correct as you have specified the name column thrice while creating your view and therefore the error is, IN case of this you have to give an alias to the other two name columns you specify while creating your view, as the view you have shown may be the correct format should be as follows:
CREATE VIEW "v_itemshort" AS 
SELECT "public"."t_item_types"."name",
 "public"."t_items"."id", "public"."t_items"."serial", "public"."t_items"."nickname",
 "public"."t_sites"."name" As Name1, "public"."t_status"."name" As Name2
 
 FROM "public"."t_items"
 INNER JOIN "public"."t_status" ON ("public"."t_items"."status_id" = "public"."t_status"."id")
 
 INNER JOIN "public"."t_sites" ON ("public"."t_items"."site_id" = "public"."t_sites"."id")
 
 INNER JOIN "public"."t_item_types" ON ("public"."t_items"."type_id" = "public"."t_item_types"."id")

Open in new window

0
 

Author Closing Comment

by:sean-keys
ID: 31468484
Thanks buddy.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: http://www.postgresql.org/ (http://www.postgresql.org/) This requires some add-o…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

649 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