How to Write a Conditional Selection SQL Query in Magento 2.3

magento2.3sql

$collection->getSelect()->where($getMainTableAlias.'.entity_id IN (SELECT catText.entity_id FROM '.$catalogCategoryEntityTextTable.' as catText where catText.attribute_id="'.$attributeId.'" AND  FIND_IN_SET("'.$groupId.'", catText.value) GROUP BY   catText.entity_id)');

I have this query. I have to remove the first where clause so as to avoid any filters but the rest will remain same. How can I perform this task?

Best Answer

Replace it with this and add your table name from which you want to get the records.

$collection->getSelect()->SELECT * FROM 'YOUR TABLE NAME';

hope it works.