简体   繁体   中英

SQL QUERY NOT IN

SELECT COUNT(accessed_time) AS total
FROM   user_db 
WHERE  application_id LIKE '1%' 
AND accessed_time BETWEEN '" + date1 +"' AND '"+daten+"'  

This query will fetch all the application id that begin with 1...i need to exclude 101....from result...how can i modify the query

Simply add a AND .

SELECT COUNT(accessed_time) AS total
FROM user_db
WHERE application_id LIKE '1%'
  AND application_id <> 101
  AND accessed_time BETWEEN '" + date1 +"' AND '"+daten+"' 
SELECT COUNT(accessed_time) AS total 
FROM user_db 
WHERE application_id LIKE '1%' AND accessed_time BETWEEN '" + date1 +"' AND '"+daten+"' 
AND application_id <> '101'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM