Select in Select using Uniqueindentifier as the key

I have 2 tables, adxprofile is the main table, adxProfileValues is the child table.
They are joined by a field called adxProfileGuid.

I want to query send the query the userkey which is the username.
The query then in turn needs to return all the child rows with the matching uniqueindentifier

I have the following statement

select adxProfileGuid
from adxprofile
where userkey = 'john'
and adxProfileGuid =
(select PropertyName
from adxProfileValues)

When I use = I get this error
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

When I use IN instead of = I get this error
Syntax error converting from a character string to uniqueidentifier.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use IN and then use the CONVERT function on PropertyName
gspronychAuthor Commented:
I get this error
Syntax error converting from a character string to uniqueidentifier.

It seems to me that using the IN statement coverts the GUID into a string.
I have tried adding convert statements to the adxProfileGuid with the same results.
Brian CroweDatabase AdministratorCommented:
Could you please translate the sentence below...

"I want to query send the query the userkey which is the username."
gspronychAuthor Commented:
Sorry for the bad gramar

I want the first query to use the GUID field in adxProfileGuid from adxprofile
select adxProfileGuid
from adxprofile
where userkey = 'john'

And return all the matching rows from adxProfileValues.
adxProfileValues has the same adxProfileGuid field with the same GUID.

Thanks for your assistance
Anthony PerkinsCommented:
This will return all the rows in adxProfileValues that match adxprofile and where userkey = "john'':

select v.*
from adxprofile p
         Inner Join adxProfileValues v On p.adxProfileGuid = v.adxProfileGuid
where p.userkey = 'john'

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.