问题描述
我的sql查询如下
选择DISTINCT date_TripDate AS TripDate,traveltype.varchar_TravelTypeCode AS TripType,contactss.Value as Mobilenumber,来自[OneC_988]。[dbo] 。[988_Details_VehicleRequest]请求加入[OneC_988]。[dbo]。[988_Details_VehicleTrip] trip on request.int_VehicleRequestID = trip.int_VehicleRequestID
和int_CityID ='1'
当我运行上面的查询输出如下
Tripdate TripType Mobilenumber int_CityID
26th aug 16 IN 9878778878 1
26th aug 16 IN 9949949990 1
26th aug 16 IN 9878778878 1
i想要在上面的sql查询中传递INT_CityID 1和2以获得如下输出
Tripdate TripType Mobilenumber int_CityID
26th aug 16 IN 9878778878 1
26th aug 16 IN 9949949990 1
26th aug 16 IN 9878778878 1
28th aug 16 IN 9878778878 2
28th aug 16 IN 9949949990 2
28th aug 16 IN 9878778878 2
我尝试了什么:
如何在sql查询中传递多个城市id
My sql query as follows
select DISTINCT date_TripDate AS TripDate,traveltype.varchar_TravelTypeCode AS TripType,contactss.Value as Mobilenumber,from [OneC_988].[dbo].[988_Details_VehicleRequest] request join [OneC_988].[dbo].[988_Details_VehicleTrip] trip on request.int_VehicleRequestID=trip.int_VehicleRequestID
and int_CityID ='1'
When i run the above query output as follows
Tripdate TripType Mobilenumber int_CityID
26th aug 16 IN 9878778878 1
26th aug 16 IN 9949949990 1
26th aug 16 IN 9878778878 1
i want to pass both INT_CityID 1 and 2 in the above sql query to get output as follows
Tripdate TripType Mobilenumber int_CityID
26th aug 16 IN 9878778878 1
26th aug 16 IN 9949949990 1
26th aug 16 IN 9878778878 1
28th aug 16 IN 9878778878 2
28th aug 16 IN 9949949990 2
28th aug 16 IN 9878778878 2
What I have tried:
how to pass mutiple city id in sql query
这篇关于如何在SQL查询中传递多个城市id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!