TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abdulmajeed Alshari
NA
266
61.3k
How get last row from each group
Aug 3 2019 10:09 PM
I have three tables (Subscripers, Subscriptions and Payments). Where the every subscriper can do one or more of subscriptions and the subscriper Pay more than one in the payments table of every subscription.
Now
.How can I show all subscriptions and get only last payment of each subscription without replication the subscriptions data in the results
how write sql code:
SELECT dbo.Subscriptions.Id, dbo.Subscripers.subscriperName, dbo.Payments.isPaid
FROM dbo.Subscriptions
( ... )
Relationship diagram as:
The Result show replications in subscriptions data as the follow Image :
Script of Schema With Data as the follow:
Create
Database
ThreeTables
go
USE ThreeTables
GO
/****** Object:
Table
[dbo].[Payments] Script
Date
: 8/3/2019 7:29:42 PM ******/
SET
ANSI_NULLS
ON
GO
SET
QUOTED_IDENTIFIER
ON
GO
CREATE
TABLE
[dbo].[Payments](
[Id] [nvarchar](128)
NOT
NULL
,
[isPaid] [
bit
]
NOT
NULL
,
[subscriptionId] [
decimal
](18, 2)
NOT
NULL
CONSTRAINT
[PK_dbo.Payments]
PRIMARY
KEY
CLUSTERED
(
[Id]
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
/****** Object:
Table
[dbo].[Subscripers] Script
Date
: 8/3/2019 7:29:43 PM ******/
SET
ANSI_NULLS
ON
GO
SET
QUOTED_IDENTIFIER
ON
GO
CREATE
TABLE
[dbo].[Subscripers](
[Id] [nvarchar](128)
NOT
NULL
,
[subscriperName] [nvarchar](
max
)
NULL
,
CONSTRAINT
[PK_dbo.Subscripers]
PRIMARY
KEY
CLUSTERED
(
[Id]
ASC
)
WITH
(PAD_INDEX =
OFF
, STATISTICS_NORECOMPUTE =
OFF
, IGNORE_DUP_KEY =
OFF
, ALLOW_ROW_LOCKS =
ON
, ALLOW_PAGE_LOCKS =
ON
)
ON
[
PRIMARY
]
)
ON
[
PRIMARY
] TEXTIMAGE_ON [
PRIMARY
]
GO
/****** Object:
Table
[dbo].[Subscriptions] Script
Date
: 8/3/2019 7:29:43 PM ******/
SET
ANSI_NULLS
ON
GO
SET
QUOTED_IDENTIFIER
ON
GO
CREATE
TABLE
[dbo].[Subscriptions](
[Id] [
decimal
](18, 2)
NOT
NULL
,
[SubscriptionState] [nvarchar](
max
)
NULL
,
[Subscriper_Id] [nvarchar](128)
NULL
,
CONSTRAINT
[PK_dbo.Subscriptions]
PRIMARY
KEY
CLUSTERED
(
[Id]
ASC
)
WITH
(PAD_INDEX =
OFF
, STATISTICS_NORECOMPUTE =
OFF
, IGNORE_DUP_KEY =
OFF
, ALLOW_ROW_LOCKS =
ON
, ALLOW_PAGE_LOCKS =
ON
)
ON
[
PRIMARY
]
)
ON
[
PRIMARY
] TEXTIMAGE_ON [
PRIMARY
]
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'2c9a266d-a455-4b7f-a1a3-8b45c222a449'
, 0,
CAST
(2.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'351fbaf4-11cb-4584-bafe-3266dc629968'
, 0,
CAST
(11.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'60eec856-3001-4522-a522-96c459a03c3b'
, 0,
CAST
(5.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'7c54991a-c3d2-4649-a999-394c4476fa13'
, 0,
CAST
(1.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'825a31ca-9494-484a-a948-4b60404752b3'
, 0,
CAST
(8.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'841ebc8d-46a1-409b-8b84-eb058c3901ac'
, 0,
CAST
(7.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id],[isPaid], [subscriptionId])
VALUES
(N
'92b04b7e-22d9-4134-aab4-ca2a30e52998'
, 0,
CAST
(9.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'a5c96a97-1bd4-4992-b5ee-9a90e1c559b3'
, 0,
CAST
(1.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'bae98c93-b048-410a-bdb9-63391e34fc4d'
, 0,
CAST
(3.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'e5affae4-c687-404b-8826-9b5f2f83a500'
, 0,
CAST
(10.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'ea7a6839-55e2-422a-ba01-28bbd4620848'
, 0,
CAST
(4.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id],[isPaid], [subscriptionId])
VALUES
(N
'f912d258-42ef-447b-97b0-cbd7f9af87df'
, 0,
CAST
(6.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'044b6b36-6738-4a4b-ab64-cb492813f3b7'
, N
'Abdulmajeed'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'0fdc0023-1250-4fb3-990b-97dc7a4cfd75'
, N
'Ali'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'1ad4aa53-e477-4a9f-b685-263a1f19504b'
, N
'Hani Ahmed'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'61972c84-54ff-4177-b438-4aea1bb7c1dc'
, N
'Mohammed'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'6d52eb17-79f3-498c-a9d0-46cf4b0ef394'
, N
'Qasem Ali'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'71ee43d9-e74b-4c28-ae5e-e389d2389028'
, N
'Yasser Abdh'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'a53ea634-5cb1-4852-b85d-07bc0bcddd98'
, N
'Hoda Nasser'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'a5d4876f-1bbd-467f-8d03-b60409b25bbc'
, N
'Gamal Ahmed'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'cda234f9-f4ed-4ae5-92e0-7270c716e900'
, N
'Waled Ali'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'd5b6aaaa-68a8-4983-adc1-22718f3a90b9'
, N
'Mostafa Omar'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'd79561cb-10b4-4b29-8e7f-76d5595faeb2'
, N
'Ali Qasem'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(1.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'd5b6aaaa-68a8-4983-adc1-22718f3a90b9'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(2.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'0fdc0023-1250-4fb3-990b-97dc7a4cfd75'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(3.00
AS
Decimal
(18, 2)),N
'New Subscription'
, N
'71ee43d9-e74b-4c28-ae5e-e389d2389028'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(4.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'd79561cb-10b4-4b29-8e7f-76d5595faeb2'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(5.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'a53ea634-5cb1-4852-b85d-07bc0bcddd98'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(6.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'61972c84-54ff-4177-b438-4aea1bb7c1dc'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(7.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'044b6b36-6738-4a4b-ab64-cb492813f3b7'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(8.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'6d52eb17-79f3-498c-a9d0-46cf4b0ef394'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(9.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'cda234f9-f4ed-4ae5-92e0-7270c716e900'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(10.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'a5d4876f-1bbd-467f-8d03-b60409b25bbc'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(11.00
AS
Decimal
(18, 2)),N
'New Subscription'
, N
'1ad4aa53-e477-4a9f-b685-263a1f19504b'
)
GO
ALTER
TABLE
[dbo].[Payments]
WITH
CHECK
ADD
CONSTRAINT
[FK_dbo.Payments_dbo.Subscriptions_subscriptionId]
FOREIGN
KEY
([subscriptionId])
REFERENCES
[dbo].[Subscriptions] ([Id])
ON
DELETE
CASCADE
GO
ALTER
TABLE
[dbo].[Payments]
CHECK
CONSTRAINT
[FK_dbo.Payments_dbo.Subscriptions_subscriptionId]
GO
ALTER
TABLE
[dbo].[Subscriptions]
WITH
CHECK
ADD
CONSTRAINT
[FK_dbo.Subscriptions_dbo.Subscripers_Subscriper_Id]
FOREIGN
KEY
([Subscriper_Id])
REFERENCES
[dbo].[Subscripers] ([Id])
GO
ALTER
TABLE
[dbo].[Subscriptions]
CHECK
CONSTRAINT
[FK_dbo.Subscriptions_dbo.Subscripers_Subscriper_Id]
GO
/************************************/
/************************************/
Create
Database
ThreeTables
go
USE ThreeTables
GO
/****** Object:
Table
[dbo].[Payments] Script
Date
: 8/3/2019 7:29:42 PM ******/
SET
ANSI_NULLS
ON
GO
SET
QUOTED_IDENTIFIER
ON
GO
CREATE
TABLE
[dbo].[Payments](
[Id] [nvarchar](128)
NOT
NULL
,
[isPaid] [
bit
]
NOT
NULL
,
[subscriptionId] [
decimal
](18, 2)
NOT
NULL
CONSTRAINT
[PK_dbo.Payments]
PRIMARY
KEY
CLUSTERED
(
[Id]
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
/****** Object:
Table
[dbo].[Subscripers] Script
Date
: 8/3/2019 7:29:43 PM ******/
SET
ANSI_NULLS
ON
GO
SET
QUOTED_IDENTIFIER
ON
GO
CREATE
TABLE
[dbo].[Subscripers](
[Id] [nvarchar](128)
NOT
NULL
,
[subscriperName] [nvarchar](
max
)
NULL
,
CONSTRAINT
[PK_dbo.Subscripers]
PRIMARY
KEY
CLUSTERED
(
[Id]
ASC
)
WITH
(PAD_INDEX =
OFF
, STATISTICS_NORECOMPUTE =
OFF
, IGNORE_DUP_KEY =
OFF
, ALLOW_ROW_LOCKS =
ON
, ALLOW_PAGE_LOCKS =
ON
)
ON
[
PRIMARY
]
)
ON
[
PRIMARY
] TEXTIMAGE_ON [
PRIMARY
]
GO
/****** Object:
Table
[dbo].[Subscriptions] Script
Date
: 8/3/2019 7:29:43 PM ******/
SET
ANSI_NULLS
ON
GO
SET
QUOTED_IDENTIFIER
ON
GO
CREATE
TABLE
[dbo].[Subscriptions](
[Id] [
decimal
](18, 2)
NOT
NULL
,
[SubscriptionState] [nvarchar](
max
)
NULL
,
[Subscriper_Id] [nvarchar](128)
NULL
,
CONSTRAINT
[PK_dbo.Subscriptions]
PRIMARY
KEY
CLUSTERED
(
[Id]
ASC
)
WITH
(PAD_INDEX =
OFF
, STATISTICS_NORECOMPUTE =
OFF
, IGNORE_DUP_KEY =
OFF
, ALLOW_ROW_LOCKS =
ON
, ALLOW_PAGE_LOCKS =
ON
)
ON
[
PRIMARY
]
)
ON
[
PRIMARY
] TEXTIMAGE_ON [
PRIMARY
]
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'2c9a266d-a455-4b7f-a1a3-8b45c222a449'
, 0,
CAST
(2.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'351fbaf4-11cb-4584-bafe-3266dc629968'
, 0,
CAST
(11.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'60eec856-3001-4522-a522-96c459a03c3b'
, 0,
CAST
(5.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'7c54991a-c3d2-4649-a999-394c4476fa13'
, 0,
CAST
(1.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'825a31ca-9494-484a-a948-4b60404752b3'
, 0,
CAST
(8.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'841ebc8d-46a1-409b-8b84-eb058c3901ac'
, 0,
CAST
(7.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id],[isPaid], [subscriptionId])
VALUES
(N
'92b04b7e-22d9-4134-aab4-ca2a30e52998'
, 0,
CAST
(9.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'a5c96a97-1bd4-4992-b5ee-9a90e1c559b3'
, 0,
CAST
(1.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'bae98c93-b048-410a-bdb9-63391e34fc4d'
, 0,
CAST
(3.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'e5affae4-c687-404b-8826-9b5f2f83a500'
, 0,
CAST
(10.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id], [isPaid], [subscriptionId])
VALUES
(N
'ea7a6839-55e2-422a-ba01-28bbd4620848'
, 0,
CAST
(4.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Payments] ([Id],[isPaid], [subscriptionId])
VALUES
(N
'f912d258-42ef-447b-97b0-cbd7f9af87df'
, 0,
CAST
(6.00
AS
Decimal
(18, 2)))
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'044b6b36-6738-4a4b-ab64-cb492813f3b7'
, N
'Abdulmajeed'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'0fdc0023-1250-4fb3-990b-97dc7a4cfd75'
, N
'Ali'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'1ad4aa53-e477-4a9f-b685-263a1f19504b'
, N
'Hani Ahmed'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'61972c84-54ff-4177-b438-4aea1bb7c1dc'
, N
'Mohammed'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'6d52eb17-79f3-498c-a9d0-46cf4b0ef394'
, N
'Qasem Ali'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'71ee43d9-e74b-4c28-ae5e-e389d2389028'
, N
'Yasser Abdh'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'a53ea634-5cb1-4852-b85d-07bc0bcddd98'
, N
'Hoda Nasser'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'a5d4876f-1bbd-467f-8d03-b60409b25bbc'
, N
'Gamal Ahmed'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'cda234f9-f4ed-4ae5-92e0-7270c716e900'
, N
'Waled Ali'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'd5b6aaaa-68a8-4983-adc1-22718f3a90b9'
, N
'Mostafa Omar'
)
GO
INSERT
[dbo].[Subscripers]
VALUES
(N
'd79561cb-10b4-4b29-8e7f-76d5595faeb2'
, N
'Ali Qasem'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(1.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'd5b6aaaa-68a8-4983-adc1-22718f3a90b9'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(2.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'0fdc0023-1250-4fb3-990b-97dc7a4cfd75'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(3.00
AS
Decimal
(18, 2)),N
'New Subscription'
, N
'71ee43d9-e74b-4c28-ae5e-e389d2389028'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(4.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'd79561cb-10b4-4b29-8e7f-76d5595faeb2'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(5.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'a53ea634-5cb1-4852-b85d-07bc0bcddd98'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(6.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'61972c84-54ff-4177-b438-4aea1bb7c1dc'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(7.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'044b6b36-6738-4a4b-ab64-cb492813f3b7'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(8.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'6d52eb17-79f3-498c-a9d0-46cf4b0ef394'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(9.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'cda234f9-f4ed-4ae5-92e0-7270c716e900'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(10.00
AS
Decimal
(18, 2)), N
'New Subscription'
, N
'a5d4876f-1bbd-467f-8d03-b60409b25bbc'
)
GO
INSERT
[dbo].[Subscriptions] ([Id], [SubscriptionState], [Subscriper_Id])
VALUES
(
CAST
(11.00
AS
Decimal
(18, 2)),N
'New Subscription'
, N
'1ad4aa53-e477-4a9f-b685-263a1f19504b'
)
GO
ALTER
TABLE
[dbo].[Payments]
WITH
CHECK
ADD
CONSTRAINT
[FK_dbo.Payments_dbo.Subscriptions_subscriptionId]
FOREIGN
KEY
([subscriptionId])
REFERENCES
[dbo].[Subscriptions] ([Id])
ON
DELETE
CASCADE
GO
ALTER
TABLE
[dbo].[Payments]
CHECK
CONSTRAINT
[FK_dbo.Payments_dbo.Subscriptions_subscriptionId]
GO
ALTER
TABLE
[dbo].[Subscriptions]
WITH
CHECK
ADD
CONSTRAINT
[FK_dbo.Subscriptions_dbo.Subscripers_Subscriper_Id]
FOREIGN
KEY
([Subscriper_Id])
REFERENCES
[dbo].[Subscripers] ([Id])
GO
ALTER
TABLE
[dbo].[Subscriptions]
CHECK
CONSTRAINT
[FK_dbo.Subscriptions_dbo.Subscripers_Subscriper_Id]
GO
Reply
Answers (
3
)
Installing SSMS, Wrong Folder
Migrating Database procedure