尝试加速 SQLITE UNION QUERY
我有下面的 SQLITE 代码
SELECT x.t,
CASE WHEN S.Status='A' AND M.Nomorebets=0 THEN S.PriceText ELSE '-' END AS Show_Price
FROM sb_Market M
LEFT OUTER JOIN
(select 2010 t union
select 2020 t union
select 2030 t union
select 2040 t union
select 2050 t union
select 2060 t union
select 2070 t
) as x
LEFT OUTER JOIN sb_Selection S ON
S.MeetingId=M.MeetingId AND
S.EventId=M.EventId AND
S.MarketId=M.MarketId AND
x.t=S.team
WHERE M.meetingid=8051 AND M.eventid=3 AND M.Name='Correct Score'
由于当前的接口限制,我必须使用上面的代码来确保如果缺少一个选择,则会出现“-”。
一些提要类似于以下内容
SelectionId Name Team Status PriceText =================================== 1 Barney 2010 A 10 2 Jim 2020 A 5 3 Matt 2030 A 6 4 John 2040 A 8 5 Paul 2050 A 15/2 6 Frank 2060 S 10/11 7 Tom 2070 A 15
使用上面的 SQL 代码是最快的& 高效的??
请提供任何有帮助的建议。 带有更新的消息会更好。
I have the below SQLITE code
SELECT x.t,
CASE WHEN S.Status='A' AND M.Nomorebets=0 THEN S.PriceText ELSE '-' END AS Show_Price
FROM sb_Market M
LEFT OUTER JOIN
(select 2010 t union
select 2020 t union
select 2030 t union
select 2040 t union
select 2050 t union
select 2060 t union
select 2070 t
) as x
LEFT OUTER JOIN sb_Selection S ON
S.MeetingId=M.MeetingId AND
S.EventId=M.EventId AND
S.MarketId=M.MarketId AND
x.t=S.team
WHERE M.meetingid=8051 AND M.eventid=3 AND M.Name='Correct Score'
With the current interface restrictions, I have to use the above code to ensure that if one selection is missing, that a '-' appears.
Some feed would be something like the following
SelectionId Name Team Status PriceText =================================== 1 Barney 2010 A 10 2 Jim 2020 A 5 3 Matt 2030 A 6 4 John 2040 A 8 5 Paul 2050 A 15/2 6 Frank 2060 S 10/11 7 Tom 2070 A 15
Is using the above SQL code the quickest & efficient??
Please advise of anything that could help. Messages with updates would be preferable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做的一些事情:
Some things you could do: