Last post Mar 05, 2011 01:25 PM by Nasri87
Mar 02, 2011 02:32 AM|Nasri87|LINK
Hi, i faced a problem during i want to create inner join in query builder.
Here is my statement
SELECT aspnet_Users.UserId, aspnet_Users.UserName, aspnet_Membership.Email, aspnet_Profile.GenderId, aspnet_Profile.BirthDate,
aspnet_Membership.UserId AS Expr1, aspnet_Profile.UserId AS Expr2
FROM aspnet_Users INNER JOIN
aspnet_Membership ON aspnet_Users.UserId = aspnet_Membership.UserId INNER JOIN
aspnet_Profile ON aspnet_Users.UserId = aspnet_Profile.UserId
WHERE (aspnet_Users.UserName = @UserName)
If i select 2 tables, i can get the result. But when i insert 1 more table, i failed to get my result. Can anybody help me?
Mar 02, 2011 03:11 AM|Lyra Belaqua|LINK
It seems that tables are dependent.
FROM aspnet_Users INNER JOIN aspnet_Membership ON aspnet_Users.UserId = aspnet_Membership.UserId INNER JOIN aspnet_Profile ON aspnet_Users.UserId = aspnet_Profile.UserId
So check that whether all the tables have proper value, if any one have no related records, then SQL will omit it.
You can use LEFT OUTER JOIN or RIGHT OUTER JOIN as per your requirement.
Hope it helps.
Mar 02, 2011 04:48 AM|Nasri87|LINK
Thank you for your reply. Actually these 3 tables are came from Asp.net login control (aspnet_user,aspnet_membership,aspnet_profile).
I still no idea how to do it. Can u provide a sample for me?
Any help is appreciated.
Mar 02, 2011 05:22 AM|Lyra Belaqua|LINK
Oops, You have customized the aspnet_profile table.
You can't modify the structure of tables in membership db.
for example you can follow below link.
I know it is not exactly matched with your query solution, however you need to get your required stuff in some other manner.
Mar 05, 2011 01:25 PM|Nasri87|LINK
Thanks a lot. Is very useful for me.