SELECT * FROM store_pricing WHERE store = :store and tot_store = :tot_store ORDER BY store asc;ELSESELECT * FROM store_pricing WHERE store = :store and tot_store = :tot_store ORDER BY store asc;ELSE
我的sql查询有问题。我需要插入一个数据,需要先检查它是否存在。如果数据已存在,则sql查询必须返回它,如果不存在,则插入并返回它。我已经在谷歌上搜索过了,但是搜索结果不太适合我的问题。INSERT INTO @tablename(@field, @conditional_field, @field, @conditional_field) "value of field"
(SQLQUERY THAT CHECK IF THERE IS AN E
如果我有一个基于SQL数据访问的具体存储库,应该将SQL传递给存储库方法,还是将它们封装在方法中。我觉得如果我通过他们,那么我是coupling my repository with SQL data access,所以我倾向于放置SQL in the methods?以下是我的两个选择:{}
public Get
就像在下面的网页上,我想在sql lite中做一个有条件的列连接 https://dev.to/gschro/conditional-column-join-in-sql-5g03 然而,这似乎是不可能的所以这是我的加入: left join query_506556 as rdi_data on rdi_data.time = y.datetime_weather AND case when a.monitor_idis null then 1 when a.monitor_id