Need logic to write SQL query
<p>I'm writing a stored procedure and passing the value from jQuery which is an array, and also I have multiple conditions.</p>

<p>I'm getting the value like (0, 24, 48) and I need to fetch the record from day difference 0 to 48.</p>

<p>Here is the same demo query.</p>

<pre><code>SELECT 
    Tb1.Id
FROM
    table tb1
INNER JOIN 
    Table2 tb2 ON tb2.Id =  Tb1.Id AND Tb2.IsFirst = 1
LEFT JOIN 
    table3 tb3 ON tb3.Id = Tb1.Id
LEFT JOIN  
    table4 tb4 ON tb4.id = table.Id
LEFT JOIN 
    table5 tb5 ON tb5.cId = tb1.CId
WHERE 
    Tb2.aging in (SELECT val FROM UDF_Split('''+@agining+''','','' ))'
ORDER BY 
    CONVERT(DateTime, TRD.DepartureDate, 101) ASC 
    OFFSET(0) * 10 ROWS FETCH NEXT 10 ROWS ONLY  
</code></pre>