1

I'm trying to name a new column in my view... here is (part of) my code:

SELECT co_url_name, score_combined,(SELECT trunc(("productAndServices" + "futurePurchase" + shipping + "customerService" + returns + "lifetimeRating")/6, 2) AS resellerRating)

Basically it's just an average of a bunch of columns.

However, the column comes up named ?column? instead and was wondering how I need to change my syntax to name the column resellerRating instead.

I tried ALTER VIEW myview RENAME COLUMN "?column?" TO resellerRating; and not surprisingly got an error.... can anyone help me figure this out?

1 Answer 1

1

Change your view definition to this:

SELECT 
    co_url_name, 
    score_combined,
    (SELECT trunc(("productAndServices" + "futurePurchase" + shipping + "customerService" + returns + "lifetimeRating")/6, 2)) AS resellerRating

If you want to post your whole query here, I can refactor it, but as it were, you need to put the alias outside the subquery.

Sign up to request clarification or add additional context in comments.

1 Comment

I appreciate the offer, but this answers my question perfectly. I'll accept your answer soon as I can! Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.