0

I keep getting this the error below when I run the Postgresql code below that. Can anyone please point me in a direction to understand why this is happening?

Error: [Pivotal][Greenplum JDBC Driver][Greenplum]column "vin8" does not exist. SQLState: 42703 ErrorCode: 0

SELECT *, substring(i_vin, 10, 8) AS VIN8
FROM datasci_stage."safety_ce_mod_out"
WHERE VIN8 = 'DG540732'
LIMIT 5;
rsajdak
  • 93
  • 12
  • 1
    SELECT *, substring(i_vin, 10, 8) AS VIN8 FROM datasci_stage."safety_ce_mod_out" WHERE substring(i_vin, 10, 8) = 'DG540732' LIMIT 5; – Oly Feb 08 '19 at 22:10
  • @Oly Thank you very much for helping me. So if I understand what you did correctly, you removed the alias in the WHERE clause and replaced it with the substring. Is that because aliases are not allowed in the WHERE clause? – rsajdak Feb 10 '19 at 01:29
  • Tricky one - column alias is declared for the output table, while table alias is declared on the source. The where statement in this case can refer to source table alias, but not to the output column. Makes sense? – Oly Mar 07 '19 at 19:09

0 Answers0