字段组合查询
刚有网友问及,数据表的姓与名是分开存储,但查询时,传入的是全名,怎样实现查询。
Insus.NET简单写了一个例子,可以参考之:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
IF OBJECT_ID('[dbo].[Employee]') IS NOT NULL DROP TABLE [dbo].[Employee] CREATE TABLE [dbo].[Employee] ( [FirstName] NVARCHAR(40), [LastName] NVARCHAR(40) ) GO INSERT INTO [dbo].[Employee] ([FirstName],[LastName]) VALUES (N'张',N'三'),(N'李',N'四'),(N'黄',N'五') SELECT [FirstName],[LastName] FROM [dbo].[Employee] WHERE ([FirstName] + [LastName]) = N'李四'