This is a big event today! I hope that a long-lasting problem can finally be solved! In the past, when a full-site search for an enterprise website was required, if it was SQL Server, it would use a temporary table to fill the product table and news into a temporary table and then search from the temporary table, if it is access, there is no way, because a lot of information says that access is not supported
This is a big event today! I hope that a long-lasting problem can finally be solved! In the past, when a full-site search for an enterprise website was required, if it was SQL server, it would use a temporary table to fill the product table and news into a temporary table and then search from the temporary table, if it is access, there is no way, because a lot of information says that access is not supported
This is a big event today!
I hope that a long-lasting problem can finally be solved!
In the past, when a full-site search for an enterprise website was required, if it was SQL server, it would use a temporary table to fill the product table and news into a temporary table and then search from the temporary table, if it is access, there is no way, because access does not support temporary tables.
Yesterday afternoon, I used asp.net to create an access project. Repeater does not support paging and access does not support stored procedures. DataSet does not support paging, so we have to find a solution on the SQL statement. After repeated research, I finally found a solution and successfully passed it. In this process, a UNION is used. In this application, UNION merges the two query results of the same table. I thought over and over again, can I merge two different tables together?
After thinking about it, I decided to work on it and find the data of a previous website, which contains two tables: [News] and [Products. Then I tried to merge several fields from two of them. The first problem occurred was that the columns of the Two Queries were different and cannot be merged. This was my negligence. After the correction, I succeeded. My heart is overjoyed. Continue the test immediately, and then add a column named 'T' to identify the source of each column, because the data query results of the two tables need to be merged, however, after the query, it is displayed on the webpage. After clicking it, you should link to different programs to display detailed addresses. Therefore, you need to differentiate them. The final result is the following:
Select Id, [P_Name], [P_Update], 'product' AS t From [product]
UNION ALL
Select id, N_title, N_Update, 'News' AS t From [news]
It should be noted that this result will contain four columns, with four columns named id, P_Name, P_Update, and t respectively. The N_title name is no longer used. So it is the following result.
If you want to get a better result, use the AS alias for the column:
Select Id, [P_Name] AS [Title], [P_Update] AS [PubDate], 'product' AS t From [product]
UNION ALL
Select id, N_title, N_Update, 'News' AS t From [news]