تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
سؤال حول sql server 2p14
#1
كيفية ايجاد اكبر  قيمة من جدولين في sqlServer2014
الرد }}
تم الشكر بواسطة:
#2
Smile 
هذا الاستعلام :

SELECT  MAX(dbo.CompanyInformation.ID) AS MaxID1, MAX(dbo.Test.ID) AS MaxID2, dbo.CompanyInformation.UserName
, dbo.Test.NameXT, dbo.CompanyInformation.CompanyName, dbo.Test.Telphone, dbo.CompanyInformation.ProjectName,
dbo.Test.Mobail, dbo.Test.Note, dbo.CompanyInformation.PublesherCom, dbo.CompanyInformation.AddressCom, 
dbo.CompanyInformation.TelphoneCom FROM  dbo.CompanyInformation INNER JOIN 
dbo.Test ON dbo.CompanyInformation.ID = dbo.Test.ID GROUP BY dbo.CompanyInformation.UserName, dbo.Test.NameXT,
 dbo.CompanyInformation.CompanyName, dbo.Test.Telphone, dbo.CompanyInformation.ProjectName, dbo.Test.Mobail,
 dbo.Test.Note, dbo.CompanyInformation.PublesherCom, dbo.CompanyInformation.AddressCom, dbo.CompanyInformation.TelphoneCom
_______________________________________________________________________________________________________________________
USE [Test]
GO
/****** Object:  Table [dbo].[CompanyInformation]    Script Date: 07/27/2018 07:09:06 م ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[CompanyInformation](
[ID] [int] NULL,
[UserName] [nvarchar](255) NULL,
[CompanyName] [nvarchar](255) NULL,
[ProjectName] [nvarchar](255) NULL,
[PublesherCom] [nvarchar](255) NULL,
[AddressCom] [nvarchar](255) NULL,
[TelphoneCom] [nvarchar](255) NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Test]    Script Date: 07/27/2018 07:09:20 م ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Test](
[ID] [int] NULL,
[NameXT] [nvarchar](50) NULL,
[Telphone] [nvarchar](50) NULL,
[Mobail] [nvarchar](50) NULL,
[Note] [nvarchar](255) NULL
) ON [PRIMARY]
GO
_____________________________________________________________________________________
الرد }}
تم الشكر بواسطة: alipro



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم