-
select top 1 product name, time, from product table.
where Product Name ='Enter the name of the product'
order by **Time desc
-
Didn't you specify an ID, why do you need group by....
select
requestid,clientip,operatetime
from table where
requestid=78921
order by
operatetime desc
limit 1
-
For example, there is a table in your database with a duplicate name named A (name, logtime) and a duplicate name
select top 1 * from tab where name='a' order by logtime desc
-
If there is a time column, the largest time column will be used.
If there is an auto-incrementing ID, go to the maximum ID
If you want to return a recordset, and you have a time column, you can do this by selecting the repeat column, the time column, and the rest of the columns.
inner join (select repeating columns, max(time columns) as time columns from table group by repeating columns) as t2
on t1.Repeat column = t2Repeat columns and t1Time column = t2Time column.
from Table as t1
-
Since the data are all duplicated, the time is different, so just take max (time).
Select Column name 1 for duplicate data and column name 2 for duplicate data ,..max(time column) from table group by Column name 1 of duplicate data, column name of duplicate data 2,..
-
Group queries are fine.
select by stat date, province name, sum (field name).
group by stat date,province name:
1. Copy columns A and B from Table 1 to columns A and B from Table 3.
2. Enter the formula in C2 in Table 3 and copy it to C248 with the filling handle in the lower right corner
3. Select C2:C248 to clearly mark the negative value in red to warn of insufficient quota.
FYI. SQL language is an abbreviation for Structured Query Language. SQL is a database query and programming language for accessing data and querying, updating, and managing relational database systems; It is also an extension for database script files.
-
Does an employee only have one card? The following statement assumes that an employee has only one card:
select ,,time of first swipe, time of second swipe from table a1 join table a2 onwhere min(logtime) from table where logcard= and logtime>
and datediff(minute,,>40and between '2014-12-28 11:00:00' and '2014-12-28 13:00:00' and
between '2014-12-28 11:00:00' and '2014-12-28 13:00:00'
-
A query statement can be found out, which is a bit troublesome to write.
-
Let's do a function uf datecompare(@date, @strdates) return int
Then it's easy to deal with.
-
Split the fields first and compare them.
-
Let's say your date field is date, and the table name is huiyiselect * from huiyi where to char(date,'yyyy-mm-dd') >= '2016-11-29'
The query is greater than this 20161129 and the data after select * from huiyi where date >='2016-11-01' and <='2016-11-29'
The query shows all the meeting data from 2016-11-01 to 2016-11-29.
Your question is also vague, I hope it can help you.
-
create table test_price (
item varchar(10),itemprice int,price_date date
insert into test_price values('Apples', 5, to_date('2013-01-01', 'yyyy-mm-dd'));
insert into test_price values('Apples', 6, to_date('2013-03-01', 'yyyy-mm-dd'));
insert into test_price values('Apples', 7, to_date('2013-05-01', 'yyyy-mm-dd'));
insert into test_price values('Oranges', 3, to_date('2013-02-01', 'yyyy-mm-dd'));
insert into test_price values('Oranges', 4, to_date('2013-04-01', 'yyyy-mm-dd'));
insert into test_price values('Oranges', 5, to_date('2013-05-01', 'yyyy-mm-dd'));
select
item,itemprice,price_date
fromselect
row_number() over(partition by item order by price_date desc) as no,test_price.*
fromtest_price
whereno = 2;
Query result: item itemprice price date
Orange 4 01-Apr -13
Apple 6 01-Mar-13
-
If you have any questions, please feel free to ask.
select * from (select row number() over(partition by substance** order by date desc) as bz,* from table name ) aa where 2
-
Take out the second-to-last date first. Then take out ** as a condition. Just write it in one.
-
Sort by item**, date, and then take the second piece of data.
The above is based on the id of your table, but it is true that if there is no id, it feels more difficult to delete it directly, but it can be done directly by a rogue method. >>>More
Column A is your name, column B is the corresponding value, assuming column C is the name of the person who is not repeated, then column D is to find the corresponding sum: >>>More
selecta, sum(c)fromtablegroupbya.
It can solve the problem you said. >>>More
Gregorian calendar: Tuesday, June 1, 2010 at 8 o'clock.
Lunar calendar: April 19 of the year of Gengyin. >>>More
Birth date: Gengzi year 癸未月癸海日 庚申时.
The eight characters are excellent, the eight characters like fire, and it is better to take the name of the five elements of the fire word. >>>More