Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL Syntaxt help


davidinottawa

Recommended Posts

Hi guys - I've posted this on an SQl and a PHP newsgroup, but thought I'd put it out here as well.

 

The PayPal contribution is severely slowing down my site at checkout. The PayPal query goes like this :

 

SELECT o.orders_status,p.*

FROM orders o

LEFT JOIN paypalipn_txn p on p.item_number = o.orders_id

AND o.customers_id = <customer number> order by o.date_purchased desc limit 1

 

Thhis statement takes about 60 seconds to execute from phpMyAdmin.

 

I re-wrote the statement and my statement takes about half a second to execute - same results.

Can anyone out there verify that I am querying the exact same parameters as the oringial statment ?

Here is mine :

 

SELECT orders_status, paypalipn_txn . *

FROM orders

INNER JOIN paypalipn_txn ON item_number = orders_id

WHERE customers_id = <customer number>

ORDER BY date_purchased DESC LIMIT 1

 

As a side note - I noticed that the PayPal query gets executed even if the client choose another payment method! Crazy! I'll need to write a small loop before this query to ensure it is only getting executed if the client has chosen PayPal as their payment choice.

 

THANK YOU!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...