SELECT x, createddate, count_ FROM
(SELECT *, count(*)
OVER
(PARTITION BY
x
) AS count_
FROM machineslocation_loc AS ml
JOIN m AS ma ON ma.mid= ml.mid
JOIN sh AS sh ON sh.shid = ma.shid
JOIN ph AS ph ON ph.phid = sh.phid
JOIN ar AS ar ON ar.arid = ph.arid
JOIN pn AS pa ON pa.pnid = ar.pnid
AND x LIKE '%705N%') tableWithCount
The table machineslocation_loc has createddate column in it. Whenever I call it says "missing FROM-clause entry for table "machineslocation_loc" but x column is coming from that table. I tried ml.createddate and machineslocation_loc.createddate. There are createddate column in other tables too