3 Replies - 567 Views - Last Post: 22 January 2018 - 07:17 AM

#1 ikhlas06   User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 330
  • Joined: 20-May 16

Invalid column name 'p.Product_ID'.

Posted 20 January 2018 - 12:14 PM

[code]select DISTINCT 
[p.Product_ID], [p.Name],[p.Description], [p.Details], [p.Price], [p.Weight], 
[a.Name], [a.Description], [p.Added_Date]
FROM PRODUCT_TB p
LEFT JOIN PRODUCT_ATTRIBUTE_TB pa ON pa.[Product_ID] = p.[Product_ID]
LEFT JOIN ATTRIBUTE_TB a ON a.[Attribute_ID] = pa.[Attribute_ID]
[/code]

i checked in tables and I do have these tables

error:
Msg 207, Level 16, State 1, Line 36
Invalid column name 'p.Product_ID'.
Msg 207, Level 16, State 1, Line 36
Invalid column name 'p.Name'.
Msg 207, Level 16, State 1, Line 36
Invalid column name 'p.Description'.
Msg 207, Level 16, State 1, Line 36
Invalid column name 'p.Details'.
Msg 207, Level 16, State 1, Line 36
Invalid column name 'p.Price'.
Msg 207, Level 16, State 1, Line 36
Invalid column name 'p.Weight'.
Msg 207, Level 16, State 1, Line 37
Invalid column name 'a.Name'.
Msg 207, Level 16, State 1, Line 37
Invalid column name 'a.Description'.
Msg 207, Level 16, State 1, Line 37
Invalid column name 'p.Added_Date'.


Is This A Good Question/Topic? 0
  • +

Replies To: Invalid column name 'p.Product_ID'.

#2 baavgai   User is offline

  • Dreaming Coder
  • member icon


Reputation: 7492
  • View blog
  • Posts: 15,527
  • Joined: 16-October 07

Re: Invalid column name 'p.Product_ID'.

Posted 20 January 2018 - 12:55 PM

You want p.[Product_ID], not [p.Product_ID].
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw   User is online

  • never lube your breaks
  • member icon

Reputation: 6819
  • View blog
  • Posts: 28,250
  • Joined: 12-December 12

Re: Invalid column name 'p.Product_ID'.

Posted 20 January 2018 - 03:00 PM

You can also omit the square brackets as none of your field names have spaces or other odd characters.
Was This Post Helpful? 0
  • +
  • -

#4 ikhlas06   User is offline

  • D.I.C Regular

Reputation: 2
  • View blog
  • Posts: 330
  • Joined: 20-May 16

Re: Invalid column name 'p.Product_ID'.

Posted 22 January 2018 - 07:17 AM

Thanks!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1