I am new to SQL query. Can you please help me with the following?
id value quotePointId asOfTime
You need to remove the WHERE condition that is limiting the results on QuoteObservations.id =1 OR QuoteObservations.id = 2
Here is the revised SQL, with that condition removed. I have also moved the JOIN conditon into the JOIN clause.
SELECT QuoteObservations.id,
QuoteObservations.value,
QuoteObservations.quotePointId,
max(QuoteObservations.asOfTime) as asOfTime,
QuoteObservations.dataProviderId,
QuotePoints.quoteType
FROM QuoteObservations
INNER JOIN
QuotePoints
ON QuoteObservations.quotePointId = QuotePoints.id
WHERE QuotePoints.quoteType in (1,2)
group by
QuoteObservations.id,
QuoteObservations.value,
QuoteObservations.quotePointId,
QuoteObservations.dataProviderId,
QuotePoints.quoteType;