deltanovember
deltanovember

Reputation: 44051

How do I select a field from the result of a select?

I have a working query as follows

SELECT r.realname contractor_name, u.uid contractor_uid, ...

How can I select just contractor_uid from this result? I have tried

select contractor_uid from (SELECT r.realname contractor_name, u.uid contractor_uid...)

But I get the error message

Every derived table must have its own alias

Upvotes: 0

Views: 41

Answers (1)

nosid
nosid

Reputation: 50044

Add a dummy name after the sub query, i.e.:

select contractor_uid from (SELECT r.realname contractor_name, u.uid contractor_uid...) t;

Upvotes: 3

Related Questions