Toad World® Forums

Question on Toad Data Point -subqueries

I have the following query, however, I cannot replicate it from the diagram tab and cannot save the query. Any help would be appreciated, also very new user of toad and SQL. Thanks.

Select distinct eaf_heat_data.heat_no,
eaf_heat_data.start_heat_ts,
eaf_heat_data.tap_temp,
(Select lmf_celox.temperature from lmf_celox where dbo.lmf_celox.heat_no = eaf_heat_data.heat_no
and lmf_celox.analysis_ts = (select min(lmf_celox.analysis_ts)
from lmf_celox where dbo.lmf_celox.heat_no = eaf_heat_data.heat_no)) as lmf_temp,
eaf_heat_data.tap_c,
eaf_heat_data.tap_o,
eaf_heat_data.crew,
eaf_heat_data.shell_id

From eaf_heat_data, lmf_celox

Where (eaf_heat_data.start_heat_ts between :start_heat_ts
and :start_heat_ts1)
and lmf_celox.temperature > ‘2800’

What database do you connect?

Could you execute the query from Sql Editor?

I am not sure but for me the query looks like its SOQL query for Salesforce. This is a completely different language and Toad supports it only partially.

Regards

Aleksey

I don’t see the join statement between the two tables in your where clause. I like using the other style of joining in the from clause (From TableA join TableB on TableA.field = TableB.field).

Also if it is possible to join instead of subquery your sql may run better. Having a subquery in the select or where clause can cause excution of that subquery for each row of data returned.