提交 e1a31f51 编写于 作者: T Tom Copeland

Add SQL examples for equality and NOT [ci skip]

上级 f0a2edc7
......@@ -472,6 +472,12 @@ NOTE: Only equality, range and subset checking are possible with Hash conditions
Client.where(locked: true)
```
This will generate SQL like this:
```sql
SELECT * FROM clients WHERE (clients.locked = 1)
```
The field name can also be a string:
```ruby
......@@ -517,13 +523,17 @@ SELECT * FROM clients WHERE (clients.orders_count IN (1,3,5))
### NOT Conditions
`NOT` SQL queries can be built by `where.not`.
`NOT` SQL queries can be built by `where.not`:
```ruby
Article.where.not(author: author)
Client.where.not(locked: true)
```
In other words, this query can be generated by calling `where` with no argument, then immediately chain with `not` passing `where` conditions.
In other words, this query can be generated by calling `where` with no argument, then immediately chain with `not` passing `where` conditions. This will generate SQL like this:
```sql
SELECT * FROM clients WHERE (clients.locked != 1)
```
Ordering
--------
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册