我創建了一個網站,顯示我省水果和蔬菜的價格。這些價格每天更新(每天約250行)。mysql查詢動態日期範圍
因此,我創建了一個MySql表來加快訪問這些信息的速度。
在桌面上顯示我的Web site我想限制顯示的日期長達1周,而不是數據庫上可用的所有日期。考慮到數據庫每天都在增加,我需要查詢這個動態的日期請求。
他們詢問我現在使用的是:
SELECT base_beta.Tipo,
base_beta.fecha_numero,
base_beta.Variedad,
base_beta.Fecha,
base_beta.alhondiga,
base_beta.corte_uno,
base_beta.corte_dos,
base_beta.corte_tres,
base_beta.corte_cuatro,
base_beta.corte_cinco,
base_beta.corte_seis,
base_beta.corte_siete,
base_beta.corte_ocho,
base_beta.corte_nueve,
base_beta.corte_diez,
base_beta.corte_once,
base_beta.corte_doce,
base_beta.corte_trece,
base_beta.corte_catorce,
base_beta.corte_quince
FROM base_beta
WHERE 1=1
AND base_beta.Tipo = 'pi'
ORDER BY base_beta.fecha_numero DESC
沒有與科爾特serveral的柱(又名價格),因爲每個項目有價格的隨機數,因爲水果和蔬菜有競價系統價格在每一輪下降。
例如,西紅柿可能從0,80€開始,然後其價格下降到0.76,0.74,0.69等等。
我必須添加什麼代碼才能顯示當天的數據和接下來的6天來完成一週的數據?
這裏是的照片:database content and format
感謝,何塞。
編輯你的問題,並顯示日期格式的樣子。另外,具有相同信息的多列,只是通過數字進行區分通常是數據庫設計不佳的標誌。通常情況下,您需要爲每個值設置一行,而不是對它們進行旋轉。 –