I can not convert Query in Sql Server 2000 -> mysql
Posted by: saytinh saytinh
Date: November 21, 2006 02:48AM

Note:I wrote by C#.Idont want convert store procdure or function.Only Query.
Can you help me?



public DataSet SelectThuLyCongTrinh(object iKey)
{
String Query = @"DECLARE @A AS VARCHAR(150)
SET @A =''
select
@A =CASE @A
WHEN '' THEN @A+CanBoThuLy
ELSE @A+', '+CanBoThuLy
END

from tbl_CanBoThuLy where HoSo_ID = " + iKey;
Query += @" SELECT Distinct
@A as tencanbo,
a.*,
b.TenCongTrinh,
b.DienTichXayDung,
b.DienTichSan,
b.SoTang,
b.ChieuCao,
b.ChieuCaoTang,
b.LoDat,
b.DienTichDat,
b.NguonGocDat,
b.ChungChiQuyHoach,
DiaChiCongTrinh = case when q.Quan_Huyen = 0 then
CASE WHEN b.SoNha IS NULL OR b.SoNha = '' THEN '' ELSE b.SoNha + ' ' END +
CASE WHEN b.TenPho IS NULL OR b.TenPho = '' THEN '' ELSE b.TenPho + ' ' END +
CASE WHEN b.TenPhuong IS NULL OR b.TenPhuong = '' THEN '' ELSE N'phường ' + b.TenPhuong END
else CASE WHEN b.SoNha IS NULL OR b.SoNha = '' THEN '' ELSE b.SoNha + ' ' END +
CASE WHEN b.TenPho IS NULL OR b.TenPho = '' THEN '' ELSE b.TenPho + ' ' END +
CASE WHEN b.TenPhuong IS NULL OR b.TenPhuong = '' THEN '' ELSE N'xã(thị trấn) ' + b.TenPhuong END end
FROM tbl_THULY a
LEFT OUTER JOIN tbl_CongTrinh b ON a.CongTrinh_ID = b.CongTrinh_ID
LEFT OUTER JOIN tbl_Quan q ON q.Quan_ID = b.Quan_ID
WHERE a.HoSo_ID = " + iKey;
return SQLServerDataAccess.getDataFromSQL(Query,"tbl_THULY");
}

Options: ReplyQuote


Subject
Written By
Posted
I can not convert Query in Sql Server 2000 -> mysql
November 21, 2006 02:48AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.