mysql - Is it valid to use DISTINCT two times in a single query -
i'm getting following error:
mysql error
1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'distinct r.
roomtype
roomtype
, i1.meal_plan
mealplan
, i1.`bed_t' @ line 3
my code is
select distinct h.`hotelname` `hotelname` , distinct r.`roomtype` `roomtype` , i1.`meal_plan` `mealplan` , i1.`bed_type` `bedtype` , i1.`roomrate` `roomrate` , i1.`pax` `pax` , i1.`childrate` `childrate` , i1.`childrate1` `childrate1` , i1.`childrate2` `childrate2` , i1.`childrate3` `childrate3` , p.`profitmarkup_type` `profit_type` , p.`applyprofit_val_room` `applyprofit_val_room` , p.`applyprofit_val_bed` `applyprofit_val_bed` `hoteldetails` h inner join `roomdetails` r on h.`hotelname` = r.`hotelname` inner join `inventorypolicy` i1 on i1.`hotel_name` = h.`hotelname` , i1.`room_plan` = r.`roomtype` , i1.`bed_type`=r.`bedtype` , i1.`meal_plan`=r.`mealplan` , i1.`suppliername`=h.`supplier` inner join `profitmarkup` p on p.`hotel_name` = h.`hotelname` , p.`suppliername` = h.`supplier` h.`active`='1' , h.`country`='mal' , h.`city`='kl' , h.`show2web`='1' , h.`expiry_date` >= 11/09/2014 , i1.`inventory_status`='1' , p.`markup_status` = '1' , 20140911 between ((i1.`date1`)+(i1.`month1`*100)+(i1.`year1`*10000)) , ((i1.`date2`)+(i1.`month2`*100)+(i1.`year2`*10000)) , 20140911 between ((p.`date1`)+(p.`month1`*100)+(p.`year1`*10000)) , ((p.`date2`)+(p.`month2`*100)+(p.`year2`*10000))
i dont know how fix this. appreciated.
as can learn documentation of select
mysql statement, distinct
can placed before field or expression selected. automatically forces single instance of in query.
and somewhere down road there sentence says everything:
distinctrow
synonymdistinct
.
Comments
Post a Comment