replaced http://salesforce.stackexchange.com/ with https://salesforce.stackexchange.com/
Source Link

Whenever we have to query multiple objects like in your case you need to query Case and Case comments prefer SOSL to query efficiently.

There is already a great reference to understand the difference between soql and sosl in below link when to use SOSL and SOQLwhen to use SOSL and SOQL

So a SOSL on the case and case comments will be needed .

Let me run through a how to use developer console for SOSL.Great news is we can use developer console of for writing the SOSL query

Here is the sample query.Please modify as you needed

FIND {hello} IN ALL FIELDS RETURNING case(Id,CaseNumber),casecomment(ParentId,CommentBody,Parent.CaseNumber)*

The screenshot of how the result looks like

enter image description here

UPDATE:

This is how the query will include where clause

FIND {hello*} IN ALL FIELDS RETURNING case(Id,CaseNumber where createddate<TODAY),casecomment(ParentId,CommentBody,Parent.CaseNumber where ParentID!=null) 

Whenever we have to query multiple objects like in your case you need to query Case and Case comments prefer SOSL to query efficiently.

There is already a great reference to understand the difference between soql and sosl in below link when to use SOSL and SOQL

So a SOSL on the case and case comments will be needed .

Let me run through a how to use developer console for SOSL.Great news is we can use developer console of for writing the SOSL query

Here is the sample query.Please modify as you needed

FIND {hello} IN ALL FIELDS RETURNING case(Id,CaseNumber),casecomment(ParentId,CommentBody,Parent.CaseNumber)*

The screenshot of how the result looks like

enter image description here

UPDATE:

This is how the query will include where clause

FIND {hello*} IN ALL FIELDS RETURNING case(Id,CaseNumber where createddate<TODAY),casecomment(ParentId,CommentBody,Parent.CaseNumber where ParentID!=null) 

Whenever we have to query multiple objects like in your case you need to query Case and Case comments prefer SOSL to query efficiently.

There is already a great reference to understand the difference between soql and sosl in below link when to use SOSL and SOQL

So a SOSL on the case and case comments will be needed .

Let me run through a how to use developer console for SOSL.Great news is we can use developer console of for writing the SOSL query

Here is the sample query.Please modify as you needed

FIND {hello} IN ALL FIELDS RETURNING case(Id,CaseNumber),casecomment(ParentId,CommentBody,Parent.CaseNumber)*

The screenshot of how the result looks like

enter image description here

UPDATE:

This is how the query will include where clause

FIND {hello*} IN ALL FIELDS RETURNING case(Id,CaseNumber where createddate<TODAY),casecomment(ParentId,CommentBody,Parent.CaseNumber where ParentID!=null) 
added 228 characters in body
Source Link
Mohith Shrivastava
  • 84.5k
  • 17
  • 136
  • 191

Whenever we have to query multiple objects like in your case you need to query Case and Case comments prefer SOSL to query efficiently.

There is already a great reference to understand the difference between soql and sosl in below link when to use SOSL and SOQL

So a SOSL on the case and case comments will be needed .

Let me run through a how to use developer console for SOSL.Great news is we can use developer console of for writing the SOSL query

Here is the sample query.Please modify as you needed

FIND {hello} IN ALL FIELDS RETURNING case(Id,CaseNumber),casecomment(ParentId,CommentBody,Parent.CaseNumber)*

The screenshot of how the result looks like

enter image description here

UPDATE:

This is how the query will include where clause

FIND {hello*} IN ALL FIELDS RETURNING case(Id,CaseNumber where createddate<TODAY),casecomment(ParentId,CommentBody,Parent.CaseNumber where ParentID!=null) 

Whenever we have to query multiple objects like in your case you need to query Case and Case comments prefer SOSL to query efficiently.

There is already a great reference to understand the difference between soql and sosl in below link when to use SOSL and SOQL

So a SOSL on the case and case comments will be needed .

Let me run through a how to use developer console for SOSL.Great news is we can use developer console of for writing the SOSL query

Here is the sample query.Please modify as you needed

FIND {hello} IN ALL FIELDS RETURNING case(Id,CaseNumber),casecomment(ParentId,CommentBody,Parent.CaseNumber)*

The screenshot of how the result looks like

enter image description here

Whenever we have to query multiple objects like in your case you need to query Case and Case comments prefer SOSL to query efficiently.

There is already a great reference to understand the difference between soql and sosl in below link when to use SOSL and SOQL

So a SOSL on the case and case comments will be needed .

Let me run through a how to use developer console for SOSL.Great news is we can use developer console of for writing the SOSL query

Here is the sample query.Please modify as you needed

FIND {hello} IN ALL FIELDS RETURNING case(Id,CaseNumber),casecomment(ParentId,CommentBody,Parent.CaseNumber)*

The screenshot of how the result looks like

enter image description here

UPDATE:

This is how the query will include where clause

FIND {hello*} IN ALL FIELDS RETURNING case(Id,CaseNumber where createddate<TODAY),casecomment(ParentId,CommentBody,Parent.CaseNumber where ParentID!=null) 
Source Link
Mohith Shrivastava
  • 84.5k
  • 17
  • 136
  • 191

Whenever we have to query multiple objects like in your case you need to query Case and Case comments prefer SOSL to query efficiently.

There is already a great reference to understand the difference between soql and sosl in below link when to use SOSL and SOQL

So a SOSL on the case and case comments will be needed .

Let me run through a how to use developer console for SOSL.Great news is we can use developer console of for writing the SOSL query

Here is the sample query.Please modify as you needed

FIND {hello} IN ALL FIELDS RETURNING case(Id,CaseNumber),casecomment(ParentId,CommentBody,Parent.CaseNumber)*

The screenshot of how the result looks like

enter image description here