Forum Discussion
slgal
10 years agoNew Member
Can I use several active link to same table?
Hello All, I have a trouble with building report using Power BI Desktop. Here is my db scheme: Persons PK_PersonId | FullName Orders PK_OrderId | FK_CustomerId | FK_CashierId Where FK_...
slgal
10 years agoNew Member
Here is my scheme:
The last picture shows the my issue and how I fix it. But I not sure is it a good way.
Looks like Anonymous propouse the same way.
But what do you mean by "if you query that will provide the output what you are looking for" ?
db sctipt just in case
CREATE TABLE [dbo].[Order]( [OrderId] [int] IDENTITY(1,1) NOT NULL, [CustomerId] [int] NOT NULL, [CashierId] [int] NOT NULL, [Total] [money] NOT NULL, [Taxes] [money] NOT NULL, [Discount] [money] NOT NULL, [Tips] [money] NOT NULL, CONSTRAINT [PK_Order] PRIMARY KEY CLUSTERED ( [OrderId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO CREATE TABLE [dbo].[Person]( [PersonId] [int] IDENTITY(1,1) NOT NULL, [FirstName] [nvarchar](255) NOT NULL, [LastName] [nvarchar](255) NOT NULL, [FullName] AS (([FirstName]+' ')+[LastName]), [IsCustomer] [bit] NOT NULL, [IsCashier] [bit] NOT NULL, CONSTRAINT [PK_Person] PRIMARY KEY CLUSTERED ( [PersonId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Order] WITH CHECK ADD CONSTRAINT [FK_Order_Person] FOREIGN KEY([CustomerId]) REFERENCES [dbo].[Person] ([PersonId]) GO ALTER TABLE [dbo].[Order] CHECK CONSTRAINT [FK_Order_Person] GO ALTER TABLE [dbo].[Order] WITH CHECK ADD CONSTRAINT [FK_Order_Person1] FOREIGN KEY([CashierId]) REFERENCES [dbo].[Person] ([PersonId]) GO ALTER TABLE [dbo].[Order] CHECK CONSTRAINT [FK_Order_Person1] GO