2016-04-26 10 views
1

で始まるinvoicenumberが役立ちます。 MySQLは、invoicenumberがいくつかの文字で始まる行だけを尋ねることを無視しています。エラーメッセージは表示されません。私が頼んだように、私はすべての請求書を手に入れます。mySQL-Queryが動作しません:xyz%

私はOR 'orders_billing'.'rechnungsnummer' LIKE 'xy%' OR 'orders_billing'.'rechnungsnummer' LIKE 'ab%'

を追加し、この部分は動作しません。誰も私にヒントをくれませんか?

SELECT  "orders_billing"."billing_id", 
          "orders_total_local"."orders_id", 
          "orders_billing"."rechnungsnummer", 
          "orders_total_local"."value" as versandkosten, 
          "orders_billing"."rechnung_crdate", 
          "orders_billing"."billing_company", 
          "orders_billing"."billing_address_id" as customers_id, 
          "orders_billing"."billing_name", 
          "orders_billing"."billing_country", 
          "orders_billing"."delivery_country", 
          "orders_billing"."rechnung_pdf", 
          "orders_products_local"."final_price", 
          "orders_products_local"."products_tax", 
          "orders_local"."currency" 
        FROM "orders_billing" 
        LEFT JOIN("orders_products_local","orders_local","orders_total_local") 
          ON("orders_products_local"."orders_id" = "orders_billing"."orders_id" AND 
           "orders_local"."orders_id"   = "orders_billing"."orders_id" AND 
           "orders_total_local"."orders_id" = "orders_billing"."orders_id" 
           ) 
        WHERE "billing_id" > '23' && "billing_id" < '27' 
        OR "orders_total_local"."class" = 'ot_shipping' 
        OR "orders_billing"."rechnungsnummer" LIKE 'ABC%' 
        OR "orders_billing"."rechnungsnummer" LIKE 'XYZ%' 
+0

は、WHERE( "BILLING_ID"> '23' && "BILLING_ID" < '27' OR '演算子の優先順位について学びます'' OR ''' OR' ''' OR' '' OR '' '' OR ''' OR' '' OR ''' OR' '' Dは難しいと伝える – Mihai

+0

これは絶対に正しいことであり、私の問題の解決策でした。 (ありがとうございました!!!) – user3391975

答えて

0

WHERE "billing_id" > '23' AND "billing_id" < '27' 
        OR ("orders_total_local"."class" = 'ot_shipping') 
        OR ("orders_billing"."rechnungsnummer" LIKE 'ABC%') 
        OR ("orders_billing"."rechnungsnummer" LIKE 'XYZ%') 

別の方法として、これを試してみてください、

WHERE "billing_id" > '23' && "billing_id" < '27' 
         || ("orders_total_local"."class" = 'ot_shipping') 
         || ("orders_billing"."rechnungsnummer" LIKE 'ABC%') 
         || ("orders_billing"."rechnungsnummer" LIKE 'XYZ%') 
関連する問題