kdudeIA
kdudeIA

Reputation: 57

Select function that references a condition in a table SQL

I am looking to find all names (PName) in a table that have ages(PAge) greater than the age of the person who has the PID of 3.

So far I have:

SELECT PName
FROM Person
WHERE PAge >= [PAge].[PID].[3]

Upvotes: 0

Views: 48

Answers (1)

TomC
TomC

Reputation: 2814

You cant reference a second row in that way, at least not in standard sql.

Use

SELECT PName FROM Person WHERE PAge >= (select PAge from Person where PID=3)

Upvotes: 3

Related Questions