はのは、私は不動産のウェブサイトを持っていると、デフォルトのページでは、私は、ユーザーが自分のパラメータ、動的SQLクエリ
にフィットするポストの数を取得するようにしたいとしましょう、私は a link to an example image
追加カウンタはすべての変更に反応し、ユーザーに自動的に番号を表示する必要があります(これはajax jqueryで行います)
私はクエリを書きましたが、すべてのパラメータが入力されている場合にのみ機能し、数少ないがまだカウンターを稼ぐ
ここは、クエリ
ALTER PROCEDURE shahar30_nadlan.CountPropertyResultsByquery
@AreaID int,
@DealID int,
@PropertyTypeId int,
@FieldMax int,
@FieldMin int,
@RoomsMax decimal,
@RoomsMin decimal,
@PriceMax int,
@PriceMin int,
@ParkingSpace bit,
@Elevator bit,
@Aircondition bit,
@Furniture bit,
@Warehouse bit,
@Balkony bit,
@handicapped bit,
@Immediate bit,
@Description NVARCHAR(MAX)
AS
BEGIN
select count(*) from Tbl_Property
where AreaID = @AreaID and
DealID = @DealID and
PropertyTypeId= @PropertyTypeId and
Field <= @FieldMax and
Field >= @FieldMin and
Rooms <= @RoomsMax and
Rooms >= @RoomsMin and
Price <= @PriceMax and
Price >= @PriceMin and
ParkingSpace = @ParkingSpace and
Elevator = @Elevator and
Aircondition = @Aircondition and
Furniture = @Furniture and
Warehouse = @Warehouse and
Balkony = @Balkony and
handicapped = @handicapped and
[Immediate] = @Immediate and
Description like '%' + @Description + '%'
END
で、 シャハルのnardiaをお願いします。
なぜ 'COALESCE()'が遅くなるのですか? –
@ypercubeこれはテスト済みだからhttp://sqlserverperformance.idera.com/tsql-optimization/performance-coalesce-null/ –
そのブログは 'COALESCE()'と 'IS NULL'を比較します。 'ISNULL() 'ではない –