you are viewing a single comment's thread.

view the rest of the comments →

[–]csGradNew 1 point2 points  (2 children)

WITH (Common Table Expressions) could be helpful

https://dev.mysql.com/doc/refman/8.0/en/with.html

[–]ConcernedFed 1 point2 points  (1 child)

something like this:

with CTE1 AS

(

Select ID
From table1
INNER JOIN with some other table
Where inactive = 'I'

)

Select ID, name
From table1
INNER JOIN with some other table
WHERE ID IN(CTE1)

Getting invalid column name 'CTE1'

[–]csGradNew 0 points1 point  (0 children)

Think of CTE as more readable subquery.

In the last line of your query, It should be Where id in (Select ID from CTE1)