1

現在「xl_date」の日時変換に問題があり、日付は MM/DD/YYYY です

クエリ例:-

SELECT orders.*, 
  customer.id AS userid, 
  customer.login, 
  convert(datetime, orders.xl_date, 101) as ddates 
FROM orders 
LEFT JOIN customer 
ON orders.userid = customers.id 
WHERE 1 
ORDER BY ddates DESC LIMIT 0, 30
4

1 に答える 1

0

STR_TO_DATE関数を使用する必要があります。例えば ​​-

SELECT STR_TO_DATE(orders.xl_date, '%m/%d/%Y') AS as ddates FROM orders

あなたの質問は -

SELECT
  orders.*, 
  customer.id AS userid, 
  customer.login, 
  STR_TO_DATE(orders.xl_date, '%m/%d/%Y')as ddates 
FROM orders 
  LEFT JOIN customer 
    ON orders.userid = customers.id 
WHERE
  1 
ORDER BY
  ddates DESC
LIMIT 0, 30
于 2013-02-06T10:46:43.993 に答える