|
|
|
Помогите составить запрос
|
|||
|---|---|---|---|
|
#18+
table ----------- id status action case_number readiness_date table1 ----------- id mid // id- table executor //INT kilometrage departure_date survey_date table2 ----------- id mid // id- table executor //INT kilometrage departure_date survey_date accounts ----------- id mid // id- table account_num account_sum paid ----------- id mid // id- table aid // id- accounts executor //INT exec_sum exec_date Нужно выбрать данные из: table.status, table.action, table.case_number, table.readiness_date, <----- table1.kilometrage, table2.kilometrage, accounts.account_num, accounts.account_sum, paid.exec_sum, paid.exec_date где accounts.mid = table.id, table1.mid = table.id, table1.executor = $_POST[idexecutor] AND (table1.departure_date >= $_POST[range_date1] AND table1.departure_date <= $_POST[range_date2]) OR (table1.survey_date >= $_POST[range_date1] AND table1.survey_date <= $_POST[range_date2]) table2.mid = table.id, table2.executor = $_POST[idexecutor] AND (table2.departure_date >= $_POST[range_date1] AND table2.departure_date <= $_POST[range_date2]) OR (table2.survey_date >= $_POST[range_date1] AND table2.survey_date <= $_POST[range_date2]) paid.mid = table.id, paid.aid = accounts.id Еще и сумму подбить по paid.exec_sum и accounts.account_sum т.е. нужно выбрать данные где встречается определенный исполнитель (idexecutor) и события (departure_date,survey_date) попадают в в период между датами (range_date1,range_date2) Несколько дней бьюсь ничего не получается. Помогите пожалуйста составить правильно запрос ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 30.06.2014, 15:21:42 |
|
||
|
|

start [/forum/topic.php?fid=47&fpage=171&tid=1834586]: |
0ms |
get settings: |
8ms |
get forum list: |
14ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
29ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
35ms |
get tp. blocked users: |
1ms |
| others: | 241ms |
| total: | 345ms |

| 0 / 0 |
