rawinson
Newbie
พลังน้ำใจ: 0
ออฟไลน์
กระทู้: 1
|
|
« เมื่อ: 15 สิงหาคม 2017, 22:50:54 » |
|
ผมพัฒนาเว็บไซต์ โดย ASP C# ดึงข้อมูลจาก SQL SERVER
หลังจากอัพลง SERVER ผ่านไปไม่กี่วัน จะปรากฏ ข้อมูลที่ดึงมาจาก ฐานข้อมูลผิดๆ ไม่ตรงตามที่ต้องการ หรือทำงานไม่ตรงตามที่เขียนไว้
ตัวอย่างโค้ด SQL
SELECT * FROM( select TOP(10) a.Property_Id, c.IsSale, c.IsLongTermRental, c.Latitue, c.Longitute, c.ZoomLevel , c.IsShortTermRental, c.SalePrice, c.RentalPrice, c.ShortTermRentalPrice, c.Guid , d.Title, e.Title as Category, f.Title as Province, k.Title as District, l.Title as SubDistrict FROM Property_Featured a JOIN Property_FeaturedPeriod b on a.Id = b.Featured_Id JOIN Properties c on a.Property_Id = c.Id JOIN Property_Local d ON a.Property_Id = d.Key_Id JOIN Property_CategoryLocal e on c.Category_Id = e.Key_Id JOIN Property_LocationLocal f on c.AddressLoc1_Id = f.Key_Id JOIN Property_LocationLocal k on c.AddressLoc2_Id = k.Key_Id JOIN Property_LocationLocal l on c.AddressLoc3_Id = l.Key_Id
WHERE b.EndDate >= getdate() and a.IsActive = 'true' AND c.Status = '0' AND c.IsActive = 'true' AND d.Language_Id = 'th-TH' and e.Language_Id = 'th-TH' AND f.Language_Id = 'th-TH' and k.Language_Id = 'th-TH' AND l.Language_Id = 'th-TH' and c.Category_Id='1' order by a.Property_Id ) DUMMY_ALIAS1 UNION ALL
SELECT * FROM ( SELECT TOP(10) a.Id, a.IsSale, a.IsLongTermRental, a.Latitue, a.Longitute, a.ZoomLevel , a.IsShortTermRental, a.SalePrice, a.RentalPrice, a.ShortTermRentalPrice, a.Guid , b.Title, c.Title as Category, d.Title as Province, e.Title as District, f.Title as SubDistrict FROM Properties a JOIN Property_Local b ON a.Id = b.Key_Id JOIN Property_CategoryLocal c on a.Category_Id = c.Key_Id JOIN Property_LocationLocal d on a.AddressLoc1_Id = d.Key_Id JOIN Property_LocationLocal e on a.AddressLoc2_Id = e.Key_Id JOIN Property_LocationLocal f on a.AddressLoc3_Id = f.Key_Id
WHERE a.Status = '0' AND a.IsActive = 'true' AND b.Language_Id = 'th-TH' AND c.Language_Id = 'th-TH' AND d.Language_Id = 'th-TH' AND e.Language_Id = 'th-TH' AND f.Language_Id = 'th-TH' and a.Category_Id='1'
order by a.Id DESC )DUMMY_ALIAS2
โดยหากเพิ่งอัพลง SERVER ไม่นานไม่เกิน 3-4 วัน เว็บไซต์ยังทำงานปกติ หากเกิน 5 วัน หรือผ่านไปสักพักจะมีอาการ คือ ได้ Record ซ้ำๆออกมา
เช่น หากทำงานปกติ จะได้ ข้อมูล Id001, Id002, Id003 ไปเรื่อยๆ แต่หากดึงข้อมูลออกมาผิดๆ จะได้ Id001, Id001, Id001,....
ไม่รู้ว่าเกิดจากอะไรครับ รบกวนผู้รู้ช่วยชี้แนะที
|