我有三个表:
A(a1, a2, a3)
//This tbl (Table) can have multiple instances of a1, but cause of its dependence on b1,
//we have a unique record each time
B(b1, a1, b2)
//tbl C has a relationship with tbl B through b1. b1 can also have multiple instances, but
//sometimes a number of unique records in this table can tie to just one record in the B tbl.
C(c1, b1, c2, c3)
例子:
//Table B sample data
b1 a1 b2
1 25 paper
2 29 pencil
3 29 parker
//Table C sample data
c1 b1 c2 c3
1 1 w long
2 2 b long
3 2 g short
4 3 v fat
说明:对于表b B中的记录2,表b C中的记录2和3应该为其形成单个记录。
到目前为止,tbl A可以在tbl B中具有与tbl A不同的多个记录。tblB在tbl
C中也可以具有多个记录,但是这些多个记录必须合并为单个记录(如果有复制tbl C中的外键,则应进行合并)。
我希望我在解释我的问题上做得很好。我需要查询才能做到这一点。有人可以帮忙吗?
补充#1:为了使事情更清楚一点,我将使用面临的实际情况。
每种药物都分为主要类别,子类别和通用名称。
-Main Classification
-Sub Classification
-Generic Name
每个通用名称都可以具有多个优势:示例:
-TRIMETHOPRIM
Strengths: 100mg, 200mg
在某些情况下,您可以拥有一个通用名称,该通用名称是两种药物的组合,并且这两种药物都有各自的优势,在这种通用名称中,优势就算在内。您也可以有多个。例子:
-SULFAMETHOXAZOLE & TRIMETHOPRIM
Strengths: 40mg & 8mg/mL, 400mg & 80mg, 800mg & 160mg
因此,为了使我能够跟踪组合的通用名称的各个优点,我需要另一个表。
GenericTbl(Id, Name, ...)
GenericDetails(Id, GenericId, ...)
Strenghts(Id, GenericDetailsId, Strength, Unit, DosageForm, ...)
我希望这有帮助。
添加#2我将id更改为整数而不是guid(uniqueidentifier)
Pharmacy_GenericDrug
GenericDrugID GenericDrugName DrugSubClassificationID ControlStatusID
1 TRIMETHOPRIM 12 2
2 SULFAME & TRIMETHOPRIM 4 1
Pharmacy_GenericDrugDetails
GenericDrugDetailsID GenericDrugID
1 1
2 2
Pharmacy_Strengths
StrengthID GenericDrugDetailsID DosageStrength Unit
1 1 200 mg
2 2 80 mg
3 2 8 mg/L
For the first#1 GenericDrugID = 1: TRIMETHOPRIM | 12 | 200 | mg | 1
For the second#2 GenericDrugID = 2: SULFAME & TRIMETHOPRIM | 4 | 80 | mg | 8 | mg/L | 1
1 > GenericDrugName | DrugSubClassificationID | DosageSrength | Unit | ControlStatusID
2 > GenericDrugName | DrugSubClassificationID | DosageSrength | Unit | DosageSrength | Unit | ControlStatusID
这是一个基于外键合并两行的查询(违反了1NF的规则)。
DECLARE @StrengthID INT
DECLARE @GenericDrugDetailsID INT
DEClARE @DosageStrength INT
DECLARE @PresentationUnitID INT
DECLARE @DosageFormID INT
DECLARE @RouteOfAdministrationID INT
DECLARE @nCombinations INT
DECLARE @maxCombinations INT
DECLARE @CurrCombinationTotal INT
DECLARE @CurrGenericDrugDetailsID INT
DECLARE @PName VARCHAR(100)
DECLARE @DName VARCHAR(100)
DECLARE @DNameAbbrev VARCHAR(50)
DECLARE @RName VARCHAR(100)
DECLARE @GetGenericDrugStrengths CURSOR
SET @nCombinations = 0
SET @CurrGenericDrugDetailsID = 0
--Get the maximum number of combinations
--=====================================================================================
SET @maxCombinations = (SELECT TOP 1 COUNT(GenericDrugDetailsID) AS maxCombinations
FROM Pharmacy_Strengths
GROUP BY GenericDrugDetailsID
ORDER BY maxCombinations desc)
--=====================================================================================
--Create a temporary temp to hold the strengths
--=====================================================================================
DECLARE @tmpSQL VARCHAR(max)
SET @tmpSQL = ''
IF EXISTS (SELECT * FROM tempdb.sys.tables WHERE NAME LIKE '%tmpStrengths%')
DROP TABLE #tmpStrengths
CREATE TABLE #tmpStrengths (
StrengthID INT NOT NULL,
GenericDrugDetailsID INT NOT NULL,
NumberOfCombinations INT NOT NULL,
DosageStrength1 INT NOT NULL,
PresentationUnitID1 INT NOT NULL,
PresentationUnitName1 VARCHAR(100) NOT NULL,
DosageFormID1 INT NOT NULL,
DosageFormName1 VARCHAR(100) NOT NULL,
DosageFormNameAbbrev1 VARCHAR(50) NULL,
RouteOfAdministrationID1 INT NOT NULL,
RouteOfAdministrationName1 VARCHAR(100) NOT NULL);
IF (@maxCombinations > 1)
BEGIN
DECLARE @counter int
SET @counter = 1
WHILE @counter < @maxCombinations
BEGIN
SET @counter = @counter + 1
SET @tmpSQL = @tmpSQL + 'ALTER TABLE #tmpStrengths ADD StrengthID' + CAST(@counter AS VARCHAR(50)) + ' INT NULL;'
SET @tmpSQL = @tmpSQL + 'ALTER TABLE #tmpStrengths ADD DosageStrength' + CAST(@counter AS VARCHAR(50)) + ' INT NULL;'
SET @tmpSQL = @tmpSQL + 'ALTER TABLE #tmpStrengths ADD PresentationUnitID' + CAST(@counter AS VARCHAR(50)) + ' INT NULL; '
SET @tmpSQL = @tmpSQL + 'ALTER TABLE #tmpStrengths ADD PresentationUnitName' + CAST(@counter AS VARCHAR(100)) + ' VARCHAR(100) NULL; '
SET @tmpSQL = @tmpSQL + 'ALTER TABLE #tmpStrengths ADD DosageFormID' + CAST(@counter AS VARCHAR(50)) + ' INT NULL; '
SET @tmpSQL = @tmpSQL + 'ALTER TABLE #tmpStrengths ADD DosageFormName' + CAST(@counter AS VARCHAR(100)) + ' VARCHAR(100) NULL; '
SET @tmpSQL = @tmpSQL + 'ALTER TABLE #tmpStrengths ADD DosageFormNameAbbrev' + CAST(@counter AS VARCHAR(50)) + ' VARCHAR(50) NULL; '
SET @tmpSQL = @tmpSQL + 'ALTER TABLE #tmpStrengths ADD RouteOfAdministrationID' + CAST(@counter AS VARCHAR(50)) + ' INT NULL; '
SET @tmpSQL = @tmpSQL + 'ALTER TABLE #tmpStrengths ADD RouteOfAdministrationName' + CAST(@counter AS VARCHAR(100)) + ' VARCHAR(100) NULL; '
END
END
EXEC(@tmpSQL)
--====================================================================================
SET @tmpSQL = ''
SET @GetGenericDrugStrengths = CURSOR FOR
SELECT StrengthID, GenericDrugDetailsID, DosageStrength, PresentationUnitID, DosageFormID, RouteOfAdministrationID
FROM Pharmacy_Strengths
ORDER BY GenericDrugDetailsID ASC
OPEN @GetGenericDrugStrengths
FETCH NEXT FROM @GetGenericDrugStrengths INTO @StrengthID, @GenericDrugDetailsID, @DosageStrength, @PresentationUnitID, @DosageFormID, @RouteOfAdministrationID
WHILE @@FETCH_STATUS = 0
BEGIN
--Get the values of Presentation Unit, Dosage Form, and Route of Administration.
SELECT @PName = PresentationUnitName
FROM Pharmacy_PresentationUnit
WHERE PresentationUnitID = @PresentationUnitID
SELECT @DName = DosageFormName, @DNameAbbrev = DosageFormNameAbbrev
FROM Pharmacy_DosageForm
WHERE DosageFormID = @DosageFormID
SELECT @RName = RouteOfAdministrationName
FROM Pharmacy_RouteOfAdministration
WHERE RouteOfAdministrationID = @RouteOfAdministrationID
IF (@GenericDrugDetailsID = @CurrGenericDrugDetailsID)
BEGIN
SET @nCombinations = (@nCombinations + 1)
--Alter the temporary table now
SET @tmpSQL = @tmpSQL + 'UPDATE #tmpStrengths
SET StrengthID' + CAST(@nCombinations AS VARCHAR(50)) + ' = ' + CAST(@StrengthID AS VARCHAR(50)) + ',
DosageStrength' + CAST(@nCombinations AS VARCHAR(50)) + ' = ' + CAST(@DosageStrength AS VARCHAR(50)) + ',
PresentationUnitID' + CAST(@nCombinations AS VARCHAR(50)) + ' = ' + CAST(@PresentationUnitID AS VARCHAR(50)) + ',
PresentationUnitName' + CAST(@nCombinations AS VARCHAR(50)) + ' = ''' + CAST(@PName AS VARCHAR(100)) + ''',
DosageFormID' + CAST(@nCombinations AS VARCHAR(50)) + ' = ' + CAST(@DosageFormID AS VARCHAR(50)) + ',
DosageFormName' + CAST(@nCombinations AS VARCHAR(50)) + ' = ''' + CAST(@DName AS VARCHAR(100)) + ''',
DosageFormNameAbbrev' + CAST(@nCombinations AS VARCHAR(50)) + ' = ''' + CAST(@DNameAbbrev AS VARCHAR(50)) + ''',
RouteOfAdministrationID' + CAST(@nCombinations AS VARCHAR(50)) + ' = ' + CAST(@RouteOfAdministrationID AS VARCHAR(50)) + ',
RouteOfAdministrationName' + CAST(@nCombinations AS VARCHAR(50)) + ' = ''' + CAST(@RName AS VARCHAR(100)) + '''
WHERE GenericDrugDetailsID = ' + CAST(@GenericDrugDetailsID AS VARCHAR(50));
EXEC(@tmpSQL);
END
ELSE
BEGIN
SET @nCombinations = 1
SET @CurrGenericDrugDetailsID = @GenericDrugDetailsID;
--Get the total number of combinations in advance
SET @CurrCombinationTotal = (SELECT COUNT(GenericDrugDetailsID)
FROM Pharmacy_Strengths
WHERE GenericDrugDetailsID = @GenericDrugDetailsID
GROUP BY GenericDrugDetailsID);
--Insert in the temporary table now
INSERT INTO #tmpStrengths (StrengthID, GenericDrugDetailsID, NumberOfCombinations,
DosageStrength1, PresentationUnitID1, PresentationUnitName1, DosageFormID1,
DosageFormName1, DosageFormNameAbbrev1, RouteOfAdministrationID1, RouteOfAdministrationName1)
VALUES (@StrengthID, @GenericDrugDetailsID, @CurrCombinationTotal, @DosageStrength,
@PresentationUnitID, @PName, @DosageFormID, @DName, @DNameAbbrev, @RouteOfAdministrationID, @RName)
END
--PRINT CAST(@StrengthID AS varchar(50)) + ' ' + CAST(@GenericDrugDetailsID AS varchar(50)) + ' ' + CAST(@DosageStrength AS varchar(50)) + ' ' + CAST(@PresentationUnitID AS varchar(50)) + ' ' + CAST(@DosageFormID as varchar(50)) + ' ' + CAST(@RouteOfAdministrationID as varchar(50))
FETCH NEXT FROM @GetGenericDrugStrengths INTO @StrengthID, @GenericDrugDetailsID, @DosageStrength, @PresentationUnitID, @DosageFormID, @RouteOfAdministrationID
END
--SELECT * from #tmpStrengths
CLOSE @GetGenericDrugStrengths
DEALLOCATE @GetGenericDrugStrengths
SELECT a.GenericDrugID,
a.GenericDrugName,
f.*,
a.InsertDate,
a.InsertFKUserAccountId,
a.UpdateDate,
a.UpdateFKUserAccountId,
a.Version
FROM Pharmacy_GenericDrug a
INNER JOIN Pharmacy_ControlStatus d ON d.ControlStatusID = a.ControlStatusID
INNER JOIN Pharmacy_GenericDrugDetails e ON e.GenericDrugID = a.GenericDrugID
INNER JOIN #tmpStrengths f ON f.GenericDrugDetailsID = e.GenericDrugDetailsID
ORDER BY GenericDrugName ASC
这是我在查询之前得到的:
GenericDrugID GenericDrugName DrugSubClassificationID DrugSubClassificationName DrugClassificationID DrugClassificationName GenericDrugDetailsID DosageStrength PresentationUnitID PresentationUnitName DosageFormID DosageFormName DosageFormNameAbbrev RouteOfAdministrationID RouteOfAdministrationName ControlStatusID ControlStatusName InsertDate InsertFKUserAccountId UpdateDate UpdateFKUserAccountId Version
------------------------------------ ---------------------------------------------------------------------------------------------------- ------------------------------------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- -------------- ------------------ ---------------------------------------------------------------------------------------------------- ------------ ---------------------------------------------------------------------------------------------------- -------------------------------------------------- ----------------------- ---------------------------------------------------------------------------------------------------- --------------- ---------------------------------------------------------------------------------------------------- ----------------------- --------------------- ----------------------- --------------------- -----------------------
83222B76-6690-42F2-BDAD-BE5BD2D19D3B Generic Drug One 8ED135ED-5FDB-419A-9C7D-E788A40EAEAC Drug Subclassification Two 61D618F3-A38A-4416-B0A4-FB29AD614B4B Drug Classification One 2 300 1 ml 2 Pill Pill 1 Mouth 3 Narcotic 2009-10-25 10:10:06.077 1 2009-11-15 07:06:03.733 1 2009-10-25 10:10:06.077
83222B76-6690-42F2-BDAD-BE5BD2D19D3B Generic Drug One 8ED135ED-5FDB-419A-9C7D-E788A40EAEAC Drug Subclassification Two 61D618F3-A38A-4416-B0A4-FB29AD614B4B Drug Classification One 2 400 1 ml 2 Pill Pill 1 Mouth 3 Narcotic 2009-10-25 10:10:06.077 1 2009-11-15 07:06:03.733 1 2009-10-25 10:10:06.077
83222B76-6690-42F2-BDAD-BE5BD2D19D3B Generic Drug One 8ED135ED-5FDB-419A-9C7D-E788A40EAEAC Drug Subclassification Two 61D618F3-A38A-4416-B0A4-FB29AD614B4B Drug Classification One 4 500 1 ml 2 Pill Pill 2 Injection 3 Narcotic 2009-10-25 10:10:06.077 1 2009-11-15 07:06:03.733 1 2009-10-25 10:10:06.077
A1D86FD2-2E65-4F2A-B7A2-7B083B71AB9B Generic Drug Two 9925D762-34B8-43B4-A96B-78374F0081B0 Drug Subclassification One C10E9F1B-3985-4DB8-8EF8-A6C82B004B9F Drug Classification Two 1 200 1 ml 2 Pill Pill 1 Mouth 2 None 2009-10-25 10:47:10.623 1 2009-11-15 04:02:47.890 1 2009-10-25 10:47:10.623
这就是我现在得到的:
GenericDrugID GenericDrugName DrugSubClassificationID DrugSubClassificationName DrugClassificationID DrugClassificationName StrengthID GenericDrugDetailsID NumberOfCombinations DosageStrength1 PresentationUnitID1 PresentationUnitName1 DosageFormID1 DosageFormName1 DosageFormNameAbbrev1 RouteOfAdministrationID1 RouteOfAdministrationName1 StrengthID2 DosageStrength2 PresentationUnitID2 PresentationUnitName2 DosageFormID2 DosageFormName2 DosageFormNameAbbrev2 RouteOfAdministrationID2 RouteOfAdministrationName2 InsertDate InsertFKUserAccountId UpdateDate UpdateFKUserAccountId Version
------------------------------------ ---------------------------------------------------------------------------------------------------- ------------------------------------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- -------------------- -------------------- --------------- ------------------- ---------------------------------------------------------------------------------------------------- ------------- ---------------------------------------------------------------------------------------------------- -------------------------------------------------- ------------------------ ---------------------------------------------------------------------------------------------------- ----------- --------------- ------------------- ---------------------------------------------------------------------------------------------------- ------------- ---------------------------------------------------------------------------------------------------- -------------------------------------------------- ------------------------ ---------------------------------------------------------------------------------------------------- ----------------------- --------------------- ----------------------- --------------------- -----------------------
83222B76-6690-42F2-BDAD-BE5BD2D19D3B Generic Drug One 8ED135ED-5FDB-419A-9C7D-E788A40EAEAC Drug Subclassification Two 61D618F3-A38A-4416-B0A4-FB29AD614B4B Drug Classification One 2 2 2 300 1 ml 2 Pill Pill 1 Mouth 3 400 1 ml 2 Pill Pill 1 Mouth 2009-10-25 10:10:06.077 1 2009-11-15 07:06:03.733 1 2009-10-25 10:10:06.077
83222B76-6690-42F2-BDAD-BE5BD2D19D3B Generic Drug One 8ED135ED-5FDB-419A-9C7D-E788A40EAEAC Drug Subclassification Two 61D618F3-A38A-4416-B0A4-FB29AD614B4B Drug Classification One 4 4 1 500 1 ml 2 Pill Pill 2 Injection NULL NULL NULL NULL NULL NULL NULL NULL NULL 2009-10-25 10:10:06.077 1 2009-11-15 07:06:03.733 1 2009-10-25 10:10:06.077
A1D86FD2-2E65-4F2A-B7A2-7B083B71AB9B Generic Drug Two 9925D762-34B8-43B4-A96B-78374F0081B0 Drug Subclassification One C10E9F1B-3985-4DB8-8EF8-A6C82B004B9F Drug Classification Two 1 1 1 200 1 ml 2 Pill Pill 1 Mouth NULL NULL NULL NULL NULL NULL NULL NULL NULL 2009-10-25 10:47:10.623 1 2009-11-15 04:02:47.890 1 2009-10-25 10:47:10.623
对于那些感兴趣的人,这些是表结构:
CREATE TABLE [dbo].[Pharmacy_GenericDrug](
[GenericDrugID] [uniqueidentifier] NOT NULL CONSTRAINT [DF__Pharmacy___Gener__4E53A1AA] DEFAULT (newid()),
[GenericDrugName] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DrugSubClassificationID] [uniqueidentifier] NOT NULL,
[ControlStatusID] [int] NOT NULL,
[InsertDate] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_GenericDrug_InsertDate] DEFAULT (getdate()),
[InsertFKUserAccountId] [int] NOT NULL,
[UpdateDate] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_GenericDrug_UpdateDate] DEFAULT (getdate()),
[UpdateFKUserAccountId] [int] NOT NULL,
[Version] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_GenericDrug_Version] DEFAULT (getdate())
)
CREATE TABLE [dbo].[Pharmacy_GenericDrugDetails](
[GenericDrugDetailsID] [int] IDENTITY(1,1) NOT NULL,
[GenericDrugID] [uniqueidentifier] NOT NULL,
[InsertDate] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_GenericDrugDetails_InsertDate] DEFAULT (getdate()),
[InsertFKUserAccountId] [int] NOT NULL,
[UpdateDate] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_GenericDrugDetails_UpdateDate] DEFAULT (getdate()),
[UpdateFKUserAccountId] [int] NOT NULL,
[Version] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_GenericDrugDetails_Version] DEFAULT (getdate())
)
CREATE TABLE [dbo].[Pharmacy_Strengths](
[StrengthID] [int] IDENTITY(1,1) NOT NULL,
[GenericDrugDetailsID] [int] NOT NULL,
[DosageStrength] [int] NOT NULL,
[PresentationUnitID] [int] NOT NULL,
[DosageFormID] [int] NOT NULL,
[RouteOfAdministrationID] [int] NOT NULL,
[InsertDate] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_StrengthCombination_InsertDate] DEFAULT (getdate()),
[InsertFKUserAccountId] [int] NOT NULL,
[UpdateDate] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_StrengthCombination_UpdateDate] DEFAULT (getdate()),
[UpdateFKUserAccountId] [int] NOT NULL,
[Version] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_StrengthCombination_Version] DEFAULT (getdate())
)
CREATE TABLE [dbo].[Pharmacy_PresentationUnit](
[PresentationUnitID] [int] IDENTITY(1,1) NOT NULL,
[PresentationUnitName] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[InsertDate] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_PresentationUnit_InsertDate] DEFAULT (getdate()),
[InsertFKUserAccountId] [int] NOT NULL,
[UpdateDate] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_PresentationUnit_UpdateDate] DEFAULT (getdate()),
[UpdateFKUserAccountId] [int] NOT NULL,
[Version] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_PresentationUnit_Version] DEFAULT (getdate())
)
CREATE TABLE [dbo].[Pharmacy_DosageForm](
[DosageFormID] [int] IDENTITY(1,1) NOT NULL,
[DosageFormName] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DosageFormNameAbbrev] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[InsertDate] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_DosageForm_InsertDate] DEFAULT (getdate()),
[InsertFKUserAccountId] [int] NOT NULL,
[UpdateDate] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_DosageForm_UpdateDate] DEFAULT (getdate()),
[UpdateFKUserAccountId] [int] NOT NULL,
[Version] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_DosageForm_Version] DEFAULT (getdate())
)
CREATE TABLE [dbo].[Pharmacy_RouteOfAdministration](
[RouteOfAdministrationID] [int] IDENTITY(1,1) NOT NULL,
[RouteOfAdministrationName] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[InsertDate] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_RouteOfAdministration_InsertDate] DEFAULT (getdate()),
[InsertFKUserAccountId] [int] NOT NULL,
[UpdateDate] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_RouteOfAdministration_UpdateDate] DEFAULT (getdate()),
[UpdateFKUserAccountId] [int] NOT NULL,
[Version] [datetime] NOT NULL CONSTRAINT [DF_Pharmacy_RouteOfAdministration_Version] DEFAULT (getdate())
)
问题内容: 我整个上午都在搜索,但是大多数合并示例仅基于一个键,而在多个键上却找不到任何东西。 pid = 111,sid = 6,eid = 123的值在x和y中都匹配,然后合并为一条记录。如果它们不匹配,只需将其原样带过来。 我想要的最终结果: 问题答案: 这是从元组中重新锁定:
问题内容: 我想合并两个或多个视频文件(它们可能是两个mp4或两个3gp或任何其他格式)。 问题答案: 您可以使用的最通用的工具是ffmpeg(如上面@Jeremy所述),但是在手机上使用它需要做一些工作。它也是LGPL许可的,其某些编码器(特别是x264)是GPL。 如果您要连接的两个文件都使用类似的编码,并且包含在从MP4派生的文件格式中(例如3GP),那么一个更简单的解决方案是使用纯Java
问题内容: 我有两个数组: 阵列1: 和数组2: 我需要基于合并这两个数组,并获得此: 我如何在不迭代低谷的情况下做到这一点? 问题答案: 你可以这样- 如果和的顺序不同,请使用以下代码: 如果和以相同的顺序使用
我有两个哈希数组: 我想在< code>a2中找到其< code>ID和< code>name字段与< code>a1中条目的< code>ID和< code>name字段相匹配的散列(不考虑< code>email或任何其他进入< code>a2的项目),然后将< code>ORDER_NO的值合并到< code>a1散列中也就是说,以下列方式结束: 我也想忽略 a2 中存在的元素,但不忽略 a
el-table 如何根据表格数据合并行。 如图所示,name列的值一样,就合并成一行;Amount 1列合并成3行 演示地址
问题内容: 我有一个问题,如果我有一排像这样 我如何将其分成三行,如下所示: / J 问题答案: 您可以使用递归CTE: SQLFiddleDEMO 编辑: 基于Marek Grzenkowicz的回答和MatBailie的评论,全新的想法: 生成从1到max(qty)的数字,并在其上加入表。 SQLFiddle演示