我想从一行中选择真实的字段

我想从一行中选择真实的字段

本文介绍了我想从一行中选择真实的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.

我有一个充满位和整数字段的表.
任何位字段都具有与int相同的字段,这意味着每个字段都为true,因此用户需要该item(request),而int字段则表示他们需要多少个项目.


像这样:

Hi.

I have a table that is full of bit and int fields.
Any bit field has a same field as int , and it means every field that is true, so users need that item(request) ,and int field, means how many of that item they need.


like This :

CREATE TABLE [dbo].[tRequest](
    [RequestID] [int] IDENTITY(1001,3) NOT NULL,
    [UserID] [int] NULL,
    [ProductCatalog] [bit] NULL,
    [ProCatCount] [int] NULL,
    [SeminarDVD] [bit] NULL,
    [SeminarDVDCount] [int] NULL,
    [LenzTester] [bit] NULL,
    [LenzTesterCount] [int] NULL,
    [TrainCD] [bit] NULL,
    [TrainCDCount] [int] NULL,
    [AirAqua] [bit] NULL,
    [AirAquaCount] [int] NULL,
    [AirAstigma] [bit] NULL,
    [AirAstigmaCount] [int] NULL,
    [SoloAqua] [bit] NULL,
    [SoloAquaCount] [int] NULL,
    [FreshLook] [bit] NULL,
    [FreshLookCount] [int] NULL,
    [IcooneBrosh] [bit] NULL,
    [IcooneBroshCount] [int] NULL,
    [IcoonePro] [bit] NULL,
    [IcooneProCount] [int] NULL,
    [IcoondeCD] [bit] NULL,
    [IcooneCDCount] [int] NULL,
    [PDate] [nvarchar](50) NULL,
    [BroshStand] [bit] NULL,
    [BroshStandCount] [int] NULL,
    [LamaStandAqua] [bit] NULL,
    [LamaStandAquaCount] [int] NULL,
    [LamaStandFresh] [bit] NULL,
    [LamaStandFreshCount] [int] NULL,
 CONSTRAINT [PK_tRequest] PRIMARY KEY CLUSTERED
(
    [RequestID] 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].[tRequest]  WITH CHECK ADD  CONSTRAINT [FK_tRequest_TAccount1] FOREIGN KEY([RequestID])
REFERENCES [dbo].[TAccount] ([AccountID])
GO

ALTER TABLE [dbo].[tRequest] CHECK CONSTRAINT [FK_tRequest_TAccount1]
GO




我想有一个查询,可以只选择该位和int字段,使第一位为真.

有什么建议吗?

在此先感谢.




I want to have a query that can select just that bit and int fields that the bit one is true.

Any suggestion?

Thanks in Advance.

推荐答案


这篇关于我想从一行中选择真实的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 19:20