Reputation: 29627
How do I do a very simple SQL SELECT
query in Ecto that does not use a table?
For example, using the MySQL command-line client, I can do this:
mysql> select 0;
+---+
| 0 |
+---+
| 0 |
+---+
1 row in set (0.00 sec)
How would I do the same in Ecto? Maybe something like this?
q = ... # some no-op queryable?
MyApp.Repo.one(q, select: 0)
Upvotes: 1
Views: 552
Reputation: 3661
You can use the Ecto.Adapters.SQL module.
Ecto.Adapters.SQL.query!(MyApp.Repo, "select 0", [])
Upvotes: 3