1
比方說,我已經有了喜歡的一些記錄,我想在那裏TYPE =「本田」和門=「4」所有剩餘的記錄也如何獲取剩餘記錄的特定記錄?
<Car id="1", type="honda", doors="4" created_at: "2015.01.01">
<Car id="2", type="jeep", created_at: "2015.01.01">
<Car id="3", type="mazda", created_at: "2015.01.01">
<Car id="4", type="honda", doors="4" created_at: "2015.01.01">
<Car id="5", type="honda", doors="2" created_at: "2015.01.01">
<Car id="6", type="honda", doors="2" created_at: "2015.01.01">
我想這一切汽車:
<Car id="1", type="honda", doors="4" created_at: "2015.01.01">
<Car id="2", type="jeep", created_at: "2015.01.01">
<Car id="3", type="mazda", created_at: "2015.01.01">
<Car id="4", type="honda", doors="4" created_at: "2015.01.01">
我有這個疑問,但它僅返回汽車,其中TYPE =「本田」和門=「4」主要是我不想列出其他類型的IS NOT
因爲我不知道他們的價值。
Car.where("type = ? AND doors = ?", "honda", "4")
感謝您的答覆,但什麼是<>? – user2931706
<>是「不等於」運算符。 如果是 –
肯定,謝謝:)你可以upvote並將這個答案標記爲解答。:) – user2931706