Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello everyone,

When I retrieve data using SQL syntax DISTINCT, I get an error "The image data type cannot be selected as DISTINCT because is not comparable".

VB
CommandInv.CommandText = "SELECT DISTINCT I.INV_NO,P.PAINT_IMG,P.PAINT_IMGSIGN,P.PAINT_IMGINVERSO" & _
  ",S.SCULPT_IMG,S.SCULPT_IMGSIGN" & _
  ",J.JEWEL_IMG" & _
  ",W.WINE_IMG" & _
  ",C.CERT_FRONTIMG,C.CERT_BACKIMG " & _
  "FROM INVENTORY.dbo.INVENTORY I " & _
    "LEFT OUTER JOIN INVENTORY.dbo.PAINTING P ON I.PAINT_ID=P.PAINT_ID " & _
    "LEFT OUTER JOIN INVENTORY.dbo.SCULPTURE S ON I.SCULPT_ID=S.SCULPT_ID " & _
    "LEFT OUTER JOIN INVENTORY.dbo.JEWELLERY J ON I.JEWEL_ID=J.JEWEL_ID " & _
    "LEFT OUTER JOIN INVENTORY.dbo.WINE W ON I.WINE_ID=W.WINE_ID " & _
    "LEFT OUTER JOIN INVENTORY.dbo.CERTIFICATE C ON I.CERT_ID=C.CERT_ID OR C.CERT_ID=P.CERT_ID OR C.CERT_ID=S.CERT_ID "


I show the data using datagridview.
Please help me regarding this... Thanks b4
Posted

1 solution

Remove the image columns from your query with the distinct key word.

If you need them in your final results the left join to the table with image columns again.
 
Share this answer
 
Comments
om3n 18-Sep-12 2:41am    
Thanks for your reply,
the problem is I have to do "distinct" the image columns. there is another way?
Mehdi Gholam 18-Sep-12 11:29am    
Like SQL said : the image columns are not comparable so you can't.
om3n 18-Sep-12 22:27pm    
Thanks Mehdi Gholam, understood

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900