= @idFetch cur_rows into @id, @maxEndClose Cur_rowsSET ROWCOUNT 0Method TwoThere are two meanings of duplicate records, one is a completely duplicate record, that is, all fields are duplicated records, and the second is some key field duplicate records, such as the Name field repeats, and other fields may not be repeated or can be ignored.1, for the first kind of repetition, easier to solve, usingSELECT DISTINCT * from TableNameYou can get a result s
%';+-------+--------+------+------+-------+| Sno | sname | Ssex | Sage | Sdept |+-------+--------+------+------+-------+|95001| Li Yong | Male | -| CS | |95002| Liu Chen | Women | +| is | |95003| Wang Min | Women | +| MA | |95004| Zhang Li | Male | -| is | |95005| Zhang San | Male | at| CS |+-------+--------+------+------+-------+5Rowsinch Set(0.05sec)//Query Sno Student information ending with 01Mysql>Select* fromStudentwhereSno Like'%01';+-------+--
INNER JOIN (select L.duo_id,l. Longitude,l.latitude from MoDEl_meid_lbxx L Group by l.duo_id) ll on M.id=ll.duo_idwhere m.state=1 Interpretation (Memo):1. A subquery can be added as a temporary parameter to any stage in the select from where2.as can temporarily assign a table alias or table name alias to write3.ifnull ((), ') when the data being found does not exist as NULL, a different value can be assigned4.distinct to re-fetch onceOther: MODEL_MEIDXX is the primary table, where all the data
Label:Date number number of warehouses2012-05-31 C001 a shop 136.002012-05-29 C001 a shop 139.002012-05-29 C001 B Shop 5.002012-05-30 C001 B Shop 6.00I only show the maximum date of the record, how does this SQL write?ThatDate number number of warehouses2012-05-31 C001 a shop 136.002012-05-30 C001 B Shop 6.00
SQL Code
Select * FromTB Twhere not exists(select 1 from TB where number =T. number and warehouse =T. Warehous
| | Carter | Thomas 77895 |+----------+-----------+---------+3. Right-connect [outer] join:// outer can be deleted. Select from persons the outer join orders on persons.id_p=orders.id_p ORDER by LastName; +----------+-----------+---------+| LastName | FirstName | OrderNo |+----------+-----------+---------+| NULL | NULL 34764 | | Adams | John 22456 | | Adams | John 24562 | | Carter | Thomas 77895 | | Carter | Thomas 44678 |+----------+------
There are the following forms, you want to query a record, press the field output (field name fieldname1,fieldname2 ...). Please specify according to the field name in your table:
Input.htm
...
The corresponding ASP file as follows, this code is very versatile (database mymdb.mdb you specify, table name tablename you specify):
Test.asp
Dim Fieldnames,fields
FieldNames = ""
' Traverse the form checkbox to sa
Http://www.jb51.net/article/34820.htm\1, look for redundant records in the table, duplicate records are based on a single field (Peopleid) to determineCopy CodeThe code is as follows:SELECT * from Peoplewhere Peopleid in (select Peopleid from People GROUP by Peopleid have count(Peopleid) > 1)2, delete redundant records in the table, duplicate records are based on a single field (Peopleid) to judge, leaving only the smallest ROWID recordsCopy CodeThe code is as follows:Delete from peoplewhere Peo
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.