and batch = #{batch}
and (batch IS NULL OR batch = '')
select top 1 *
from asr_loc_detl
where 1=1
and loc_no = #{locNo}
and matnr = #{matnr}
and supp_code = #{suppCode}
delete from asr_loc_detl
where 1=1
and loc_no = #{locNo}
and matnr = #{matnr}
update asr_loc_detl
set anfme = #{anfme}
, modi_time = getdate()
where 1=1
and loc_no = #{locNo}
and matnr = #{matnr}
and three_code = #{threeCode}
and supp_code = #{suppCode}
and dead_time = #{deadTime}
and a.loc_no like '%' + #{loc_no} + '%'
and a.matnr like '%' + #{matnr} + '%'
and a.maktx like '%' + #{maktx} + '%'
and a.anfme like '%' + #{anfme} + '%'
and a.modi_time between #{startTime} and #{endTime}
select * from
(
select
ROW_NUMBER() over (order by a.appe_time,a.matnr,a.loc_no) as row,
a.*
from asr_loc_detl a
left join asr_loc_mast b on a.loc_no = b.loc_no
where 1=1
and b.loc_sts = 'F'
) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
select
count(1)
from asr_loc_detl a
left join asr_loc_mast b on a.loc_no = b.loc_no
where 1=1
and b.loc_sts = 'F'
select * from
(
select
ROW_NUMBER() over (order by sum(a.anfme) desc) as row
, a.matnr
, sum(a.anfme) as anfme
from asr_loc_detl a
where 1=1
group by a.matnr
) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
select count(1) as count from
(
select
a.matnr
from asr_loc_detl a
where 1=1
group by a.matnr
) b
select
ROW_NUMBER() over (order by sum(a.anfme) desc) as row
, a.matnr
, sum(a.anfme) as anfme
from asr_loc_detl a
where 1=1
group by a.matnr
select a.* from asr_loc_detl a left join asr_loc_mast b on a.loc_no = b.loc_no
where 1=1
and b.loc_sts = 'F'
and a.matnr = #{matnr}
order by
DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time)
desc,
case
when (left(a.loc_no, 2) = '01') then 0
when (left(a.loc_no, 2) = '02') then 1
when (left(a.loc_no, 2) = '03') then 1
when (left(a.loc_no, 2) = '04') then 0
when (left(a.loc_no, 2) = '05') then 0
when (left(a.loc_no, 2) = '06') then 1
when (left(a.loc_no, 2) = '07') then 1
when (left(a.loc_no, 2) = '08') then 0
else 0
end
desc
select a.* from asr_loc_detl a left join asr_loc_mast b on a.loc_no = b.loc_no where a.matnr = #{matnr} and b.loc_sts = 'F'
select count(*) from asr_loc_detl where loc_no = #{loc_no}
select
*
from
(
select
no = 1,
orderBy = 'true',
b.bay1 as bay,
sum(anfme) as count
from asr_loc_detl a
left join asr_loc_mast b on a.loc_no = b.loc_no
where 1=1
and b.loc_sts = 'F'
and a.matnr = #{matnr}
and b.row1 >= 31
and b.row1 <= 32
group by b.bay1
union
select
no = 2,
orderBy = 'true',
b.bay1 as bay,
sum(anfme) as count
from asr_loc_detl a
left join asr_loc_mast b on a.loc_no = b.loc_no
where 1=1
and b.loc_sts = 'F'
and a.matnr = #{matnr}
and b.row1 >= 2
and b.row1 <= 17
group by b.bay1
union
select
no = 3,
orderBy = 'false',
b.bay1 as bay,
sum(anfme) as count
from asr_loc_detl a
left join asr_loc_mast b on a.loc_no = b.loc_no
where 1=1
and b.loc_sts = 'F'
and a.matnr = #{matnr}
and b.row1 >= 18
and b.row1 <= 30
group by b.bay1
) a
order by no, count desc
select
a.*
from asr_loc_detl a
left join asr_loc_mast b on a.loc_no = b.loc_no
where 1=1
and b.row1 >= 31
and b.row1 <= 32
and b.row1 >= 2
and b.row1 <= 17
and b.row1 >= 18
and b.row1 <= 30
and a.matnr = #{matnr}
and b.bay1 = #{bay}
and b.loc_sts = 'F'
order by b.row1
desc
select sum(anfme) as count from man_loc_detl
where 1=1
and matnr = #{matnr}
and batch = #{batch}
select
matnr,
batch,
count(anfme) as count
from asr_loc_detl
where 1=1
group by matnr,batch
SELECT SUM(anfme) FROM asr_loc_detl
SELECT
*
FROM
[dbo].[asr_loc_detl]
WHERE
DATALENGTH( batch ) != 11 or
batch LIKE '%[a-z]%'
SELECT
ld.loc_no
FROM asr_loc_detl ld
LEFT JOIN asr_loc_mast lm ON ld.loc_no = lm.loc_no
LEFT JOIN (
select
loc_no,
count(1) as count
from asr_loc_detl
where 1=1
group by loc_no
) dual on dual.loc_no = lm.loc_no
WHERE 1 = 1
AND ld.matnr = #{matnr}
AND (lm.loc_sts = 'F')
AND dual.count = 1
ORDER BY lm.modi_time ASC
select *
from asr_loc_detl
where
1 = 1
and order_no like '%' + #{orderNo} + '%'
and loc_no like '%' + #{locNo} + '%'
and specs like '%' + #{specs} + '%'
and matnr like '%' + #{matnr} + '%'
and maktx like '%' + #{maktx} + '%';
select * from asr_loc_detl
where 1=1
and loc_no = #{locNo}
update asr_loc_detl
set stock_freeze = #{stockFreeze}
, modi_time = getdate()
where 1=1
and loc_no = #{locNo}
and matnr = #{matnr}