2017-03-17 12 views

答えて

3

問題は、文字列を連結する場合、クエリは、文字列のいずれかにスペースを追加

... from images,productswhere images.product_name = ... 

のように見える終わるので、あなたは、productswhereの間にスペースを持っていないということです:

ps = con.prepareStatement("Select product_id,image_name,images.product_name,price," 
         + "company_name from images,products" 
         + " where images.product_name = products.product_name ORDER BY hits DESC LIMIT 5"); 

どのプログラミング言語を使用しているのかはわかりませんが、多くの場合、文字列にまたがることができます。したがって、連結は必要ありません。

ps = con.prepareStatement("Select product_id,image_name,images.product_name,price,company_name 
         from images,products 
         where images.product_name = products.product_name 
         ORDER BY hits DESC LIMIT 5"); 
+0

私の悪いおかげですbtwすぐに役立ちます – PVP

関連する問題