Yuki Yuki - 3 months ago 6
SQL Question

SQL performance for select from where result of table

I would like to ask for performance of SQL. This is my query:

Select
A.code
,A.name
,(Select
B.price
From B
Where B.card = A.card
And B.quote = A.quote)
,(Select
B.quantity
From B
Where B.card = A.card
And B.quote = A.quote)
From A
Where A.flag = '0'
And A.date = '2016/09/02'


Something like this. Is it good performance query? Is will slow if data will big amount. How should I make query for more good performance?

Sorry for my poor English and thanks in advance

Answer

try this, faster in time execute

Select 
    A.code
   ,A.name
   ,B.price
   ,B.quantity

From A
left join B on B.card = A.card And B.quote = A.quote
Where A.flag = '0'
And A.date = '2016/09/02
Comments