-
There is no bottom in select
select top 1 * from table order by field 1 desc"
order by field1 desc is to sort it in reverse order, and then check its first row, which is the last one.
If you answer well, give points.
-
The requirement is to take the last field, not the last record.
This can be achieved using dynamic SQL as follows:
declare @fieldname varchar(50)select @fieldname =
select top 1
from sysobjects o inner joinsyscolumns c on =
where '[tablename]'
order by desc)
declare @sql varchar(1000)set @sql='select '+@fieldname+' from [tablename] .'
exec(@sql)
-
In the case of an oracle database:
select * from table where rownum=(select cuont(*)form table);
The last record of this query is the last record you entered the data in.
-
while(
If you have a problem with your loop, the loop of your database record will be finished when i=0, in this case, your loop should be 1, then there must be only the last data.
Put gc[i].setname("name"));The following } is changed to; The front will be fine.
-
<%'Database connection file ......
<%'Read the last id value.
sql="select id from user order by id desc "
set rs=
Outputs the last ID
rs("id")
Closing the database connection is ......
The first floor is also correct.
-
id="select max(id) from the table name")(0)
That's the ID you want
-
select * from order a, ( select order number, max (status) status from order group by order number ) b
where a.Order number = bOrder number and aStatus = bState.
There is a requirement that the states be sorted by this state.
If it can't be sorted, you need something with a serial number, and you can use this serial number to get a record of the last operation.
-
select
from table main
wherenot exists ( select 1 from table sub where main.)Order number = subOrder number and main
Date < subDate).
The algorithm is that for each row of data, there is no data with the same order number as the bank's order number and a date greater than the bank's date.
-
You're talking about the last date.
select * from table where (order number, date) in (select order number, max (date) from table group by order number);
-
select * from table order by id desc
The last keyword, desc, means to use reverse order.
-
You have 2 query statements and 2 nsql, so the setting is contradictory, it is recommended to change it to a query statement:
sql="select top 10 * from [dv_topic] order by topicid desc,boardid desc"
That's it, priority topicid in reverse order and then boardid in reverse order, you try!
-
Both boardid and topicid fields are available in the dv topic, right?
nsql="select top 10 * from [dv_topic] order by boardid desc"You have this order by boardid. It would be nice to use order by topicid desc.
-
Are your boardIDs and toppicIDs the same record? I don't think that query statement of yours should be written like this!
-
select max(column name) from the maximum value of the table.
select top 1 column name from table order by column name desc last value.
-
There is a max function in the database that can find the maximum value of a column of -
-
Click on a menu item and a jframe will pop up to display the data in the database! But it's an error! What form**?,If not** but jlabel, this can also be displayed.,It's just a little difficult to do the aesthetics I give.。
-
SSH framework, automatically generate the DAO layer implementation class, call the findall() method, put it in the list collection, the page directly iterates over the collection, and then, the third one is added with an ognl expression. If you are proficient and the machine is better, it can be done in 5 minutes
-
This is to read it out with resultset. Read both columns? Is it okay to read it out and add it up and then output it? Do you want to be specific**?
-
Computation can be performed in the database.
select sum(price*count) from table_name group by id;
Then read the result with it.
-
SQL writes select sum(quantity***) as alias from the table.
You can do what JDBC wants.
select ,from emp e left jion dept don ;
Left Company. The left link is, the left side prevails, and the right side is useless to make up for it. >>>More
It seems that there is something called triggers in the DB, and there seems to be another thing called transactions.