Answer the question
In order to leave comments, you need to log in
There is a data upload problem. What are some ideas?
Hello, I have such a problem. There are two requests. The first unloads dates under certain conditions. The second query, for each date, makes us an analysis, i.e. uploads the data we need. The problem is that you have to manually insert each date from the first request into the second one. How can this be done automatically or semi-automatically?
You cannot combine these two queries, they take a very long time to download separately .... All this is done in Oracle ... No web
Answer the question
In order to leave comments, you need to log in
I think it can be implemented through the cursor - the first request sends data to the cursor, the following requests are processed by iterations of the cursor.
datasql.ru/sqlandpol/14.htm
save the result of the first one into a "temporary" table, unload from it already.
set the second request on this plate. "temporary" in quotes - because the classic TEMPORARY will die after the session is closed. Well, or do everything in 1 session.
You have a contradiction in the task
"It is impossible to combine these two requests, they are unloaded separately for a very long time"
If separately for a long time, then together it should be fast.
Try hint /*+ materialize */
I'm not sure I understood the problem correctly. What do you mean by manual. But offhand.. dates into an array... $ dates
Next
foreach $ dates as $ date
Select * from .. where date=$date
P.s. essentially wrote under mysql-php
You can pull out 2 arrays separately according to the necessary parameters and then combine them through php:
First we pull out the dates:
then we reshape the dates into a new array, because the dates pulled out can go out of order
and we put the dates for which we need data into a separate array:
foreach ($dates as $key => $date)
{
$data_to_show[$key] = $date;
$dates_array[] = $date['date'];
}
foreach ($analiz as $row)
{
$data_to_show[$row['analiz_key']][] = $row;
}
$users = $this->user_model->get_users();
foreach ($users as $user)
{
$users_to_show[$user['username']] = $user;
$names[] = $user['username'];
}
$cars = $this->user_model->get_cars($names);
foreach ($cars as $car)
{
$users_to_show[$car['owner']]['cars'][] = $car;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question