4

我想在 sqlx 中运行嵌套查询。这是我尝试过的:

sqlx::query_as!(NseData, "select * from nse_data  where trading_day = (select max(trading_day) from nse_data)").fetch_one(&app_context.db_connection).await?;

但它给了我以下错误......

error[E0658]: attributes on expressions are experimental
  --> db/src/nse_data.rs:30:9
   |
30 |         sqlx::query_as!(NseData, "select * from nse_data  where trading_day = (select max(trading_day) from nse_data)").await?
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
4

0 回答 0