'How can I display a set of data from 2 database tables? Winforms
I created a Winforms app and a database with 2 tables in Visual Studio:
Member- holds details like first nameMembership- holds a membership type basic, VIP.
I want to display membership type from the Membership table and the FirstName from the Member table.
I have added the foreign key for the membership table to Member. Now I try to create the view as below. While this works, when I show results of the view , it creates all the requested data 3 times:
MemberID FirstName Type
-------------------------------
1 Tommy Basic
2 Sammy VIP
3 Alley Basic
1 Tommy Basic
2 Sammy VIP
3 Alley Basic
1 Tommy Basic
2 Sammy VIP
3 Alley Basic
The code for the view:
CREATE VIEW [dbo].[Memberdetails]
AS
SELECT Member.MemberId, Member.FirstName, Membership.Type
FROM [Member], [Membership]
Not sure how to fix it just to display it once.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
