Nirvriti Sharma

Nirvriti Sharma

  • 2k
  • 150
  • 2.5k

set default value

May 3 2022 11:35 AM

this is the query , in which i want default value is Brand should be Maruti

 public static string TopSixCarsByBrand(string _brand)
        {
            var _sql = "SELECT TOP(6)ci.car_ID,ci.user_ID,ci.brand,ci.modelType,ci.expectedPrice,ci.saleCity,ci.totalViews,ci.transmission,ci.modelYear,ci.totalDriven,ci.modelYear,ci.fuelType,ci.color,cd.primaryImage AS primary_Image,cd.imagePath as image_Path FROM CarInfo ci ";
            if(!string.IsNullOrEmpty(_brand) && _brand != "All Manufacturers")
            {
            _sql += "INNER JOIN CarDetail cd ON ci.car_ID=cd.car_ID WHERE ci.brand='" + _brand + "' AND cd.primaryImage=1 AND adContentType='Good'  AND (ci.isSold<>1 or ci.isSold is null);";

            }
            else
            {
                _sql += "INNER JOIN CarDetail cd ON ci.car_ID=cd.car_ID WHERE cd.primaryImage=1 AND adContentType='Good'  AND (ci.isSold<>1 or ci.isSold is null);";

            }
            return _sql;
        }

 

 

above query i am using


Answers (4)