- how do I query the last 100 pieces of data in multiple tables in the ORACLE database? For example, the two tables of An and B have a time field, and the last 100 items of data in tables An and B are not the last 100 items in An and B.
--sqlserver
-- A B [Id][Time]
SELECT TOP 100 [Id],[Time] FROM
(
SELECT [Id],[Time] FROM [Table_A]
UNION ALL
SELECT [Id],[Time] FROM [Table_B]
) [NewTable_V]
ORDER BY [Time] DESC
I don't know if SQL itself has any good methods, but we can work around it:
find the last 100 items of data in two tables, then these 100 items of data must be in the first 100 items of An and B.
is simple enough to find the first 100 pieces of data for An and B, and then sort them in the business logic.
use two tables union to combine the last hundred pieces of data to form a temporary table
what is stored in the database is the html code, which is mainly a piece of div content, including the style, does not contain the body and other tags, and the label is strict in opening and closing. If I want to query the keyword "class " now, if I us...
is currently self-learning mysql,. When querying, sometimes you need to use as aliases, but after adding as aliases to the following two query statements, why is it incorrect? 1, select cat_id,goods_name,shop_price from goods where shop_price in (sele...
The business scenario is as follows: I provide a ws server A for client B to call. Each call, the client inserts a piece of data into the database tab and then submits it. My server An internally calls another server C, and passes this data to the serve...
1. Process: Python looks up the data in the table through cx_Oracle and inserts the data into another table. 2. The type of date and time stored in both tables is of type Date. 3. The time field I took from the query table prints out that the type i...
as shown in the figure, this association query is different in that it is associated with the same table indicates that table_test requirement: first query the result set of the field whose reply_type is 0, and then use the reply_id of the resul...
I want to sort each person s type in descending order according to the sum of the sl of each person s sl. What should I do with ...
< H2 > tables: < H2 > employee employee_orgn: federated primary key (employee_id,orgn_id), index 1, 2:orgn_id employees, index orgn < H2 > sql: < H2 > explain SELECT DISTINCT e.* FROM employee e LEFT JOIN employee_orgn eo ...
problem description is the principle of mysql multi-database and multi-table joint query based on Synchronize double writing? the platform version of the problem and what methods you have tried try to find it in books such as mysql performance opt...
wrote an attempt in oracle. I want to add a field to get the QTYGOOD and of the same RD.SKU line. CREATE OR REPLACE VIEW aaa AS SELECT R.WHSEID, RD.STORERKEY, RD.SKU, CASE WHEN LOC.LOCATIONCATEGORY <> NG AND RD.COND...
the structure of the table is as follows: now I need to query the contents from different tables according to the user s input. How can I quickly and effectively find out the results I want? my idea is to associate the three tables, use case.whe...
Environment: Spring3 SpringMvc Hiberate4 SqlServer2005 Oracle11g now it s time to replace the sqlServer database with the oracle database. After changing the database configuration, the project can start normally, but an error will be reported as soo...
what do you usually consider when adding an index? I usually add an index by querying a few fields in the where clause and adding an index to those fields. ...
start with in Oracle. How to optimize connect by prior? an address table has a total of 8-level addresses. Pass in the address id, to query all the superior addresses. The code is . select address_id addressId, address_name addressName, ...