-
select * from log a,(select ,max(date) from logwhere id='10000'
group by
bwhere
Why is the following one time-consuming?
select * from log a,(select ,max(date) from loggroup by
bwhere and '10000'
-
1. Create a Junit test.
2. Use the setup() and teardown() methods.
3. Generate a session in two methods respectively, open a transaction, commit a transaction and close a session First test the local SQL query, that is, the commonly used SQL statement executes SQL through the createsqlquery method of the session, and loads the object to be queried.
4. The method of conditional query, Hibernate uses the method of :stuname to occupy the parameters in the SQL and passes"The name of the parameter","parameters") to assign a value.
5. The corresponding query result.
-
This can be done with the group by statement.
For example, the test table contains the following data:
To find out the sum of CNTs for each hour of the day on February 25, you can use the following statement:
with t as
select number rn from master..spt_values where type='p' and number<=23)
select hours,sum(isnull(cnt,0)) quantity from t left join test on ,begin date,12,2)
as int) group by
Query Result:
-
Use the job scheduled task execution statement to define the execution interval to 1 hour, and the query condition is that the year, month, and day are equal to the system time at that time.
The hour of the field is equal to the current hour hour(field)=hour(getdate()).
F get domain contrast is a formatting function (should be written by yourself), the first parameter (arg prod spec id) according to the second parameter (120) formatting and return the result to the v bill code, according to the function naming method, the above ** should be the standard format for getting the date.
2009-07-17 18:10 [Zhejiang Hangzhou Nanxingqiao Company] receiver [Yuan Zhongkui] has been received. >>>More
YTO Express: D026470055
2012-02-29 18:53:23: Science City, Fengtai District, Beijing Salesman Pick-up Person: Jia Lijun. >>>More
Waybill number Date Departure station Destination Number of pieces Signatory Signatory Signature time Signing**. >>>More
Waybill number Date Departure station Destination Number of pieces Signatory Signatory Signature time Signing**. >>>More