Hey guys,
So I have this SQL select statement:
SELECT *, SUM(downloads) AS totaldownloads FROM stats WHERE day LIKE ‘20’ AND month LIKE ‘02’ AND year LIKE ‘2007’ AND name LIKE ‘%test%’ AND type = ‘text’ GROUP BY name
And I want to basically modify the statement so that as well as matching my name column, a column called ‘path’ also matches.
If I do this:
SELECT *, SUM(downloads) AS totaldownloads FROM stats WHERE day LIKE ‘20’ AND month LIKE ‘02’ AND year LIKE ‘2007’ AND name LIKE ‘%test%’ OR path = ‘%path%’ AND type = ‘text’ GROUP BY name
Is it separating the statement into two conditions? In the below the bold section is what I see as possibly being statement B, non bold statement A.
SELECT *, SUM(downloads) AS totaldownloads FROM stats WHERE day LIKE ‘20’ AND month LIKE ‘02’ AND year LIKE ‘2007’ AND name LIKE ‘%test%’ OR path = ‘%path%’ AND type = ‘text’ GROUP BY name
If that’s the case what’s the correct syntax??
If this doesn’t make sense…someone pipe up an d let me know!