string1 = ["1.10","1.1","1.23","2.2","2.20"]
for x in string1:
if x.find('0') > 0:
place = string1.index(x)
string1.remove(x)
string1.insert(place+1, x)
print (string1)
在上面的SQL查询中,我想使用特定的SELECT
tbl_tmpdtr.id,
tbl_tmpdtr.userid,
date(tbl_tmpdtr.in_out) as in_out,
tbl_tmpdtr.status,
tbl_employee.emp_id,
tbl_employee.emp_lname,
tbl_employee.emp_mname,
tbl_employee.emp_fname
FROM tbl_tmpdtr
INNER JOIN tbl_employee
ON tbl_tmpdtr.userid = tbl_employee.emp_id
WHERE
tbl_tmpdtr.in_out >= '2015-05-01'
AND tbl_tmpdtr.in_out <= '2015-05-05'
GROUP BY
tbl_tmpdtr.userid
进行查询。但我已经使用了id
子句。我该怎么做呢?或者你们有什么想法?还是任何方法?
答案 0 :(得分:1)
如果我理解正确,这将对您有所帮助:
SELECT
tbl_tmpdtr.id,
tbl_tmpdtr.userid,
date(tbl_tmpdtr.in_out) as in_out,
tbl_tmpdtr.status,
tbl_employee.emp_id,
tbl_employee.emp_lname,
tbl_employee.emp_mname,
tbl_employee.emp_fname
FROM tbl_tmpdtr
INNER JOIN tbl_employee
ON tbl_tmpdtr.userid = tbl_employee.emp_id
WHERE
tbl_tmpdtr.in_out >= '2015-05-01'
AND tbl_tmpdtr.in_out <= '2015-05-05' and tbl_tmpdtr.id=(specific id)
GROUP BY
tbl_tmpdtr.userid
答案 1 :(得分:0)
您可以使用AND
或 ON
条款中的WHERE
子句添加条件。
开启:
SELECT
tbl_tmpdtr.id,
tbl_tmpdtr.userid,
date(tbl_tmpdtr.in_out) as in_out,
tbl_tmpdtr.status,
tbl_employee.emp_id,
tbl_employee.emp_lname,
tbl_employee.emp_mname,
tbl_employee.emp_fname
FROM tbl_tmpdtr
INNER JOIN tbl_employee
ON tbl_tmpdtr.userid = tbl_employee.emp_id
AND tbl_tmpdtr.id = {some id}
WHERE
tbl_tmpdtr.in_out >= '2015-05-01'
AND tbl_tmpdtr.in_out <= '2015-05-05'
GROUP BY
tbl_tmpdtr.userid
<强> WHERE 强>:
SELECT
tbl_tmpdtr.id,
tbl_tmpdtr.userid,
date(tbl_tmpdtr.in_out) as in_out,
tbl_tmpdtr.status,
tbl_employee.emp_id,
tbl_employee.emp_lname,
tbl_employee.emp_mname,
tbl_employee.emp_fname
FROM tbl_tmpdtr
INNER JOIN tbl_employee
ON tbl_tmpdtr.userid = tbl_employee.emp_id
WHERE
tbl_tmpdtr.in_out >= '2015-05-01'
AND tbl_tmpdtr.in_out <= '2015-05-05'
AND tbl_tmpdtr.id = {some id}
GROUP BY
tbl_tmpdtr.userid
答案 2 :(得分:0)
SELECT
tbl_tmpdtr.id,
tbl_tmpdtr.userid,
date(tbl_tmpdtr.in_out) as in_out,
tbl_tmpdtr.status,
tbl_employee.emp_id,
tbl_employee.emp_lname,
tbl_employee.emp_mname,
tbl_employee.emp_fname
FROM tbl_tmpdtr
INNER JOIN tbl_employee
ON tbl_tmpdtr.userid = tbl_employee.emp_id
WHERE
tbl_tmpdtr.in_out between '2015-05-01' and '2015-05-05' and tbl_tmpdtr.id=(specific id)
GROUP BY
tbl_tmpdtr.userid