V
V
ValeraValera2017-08-02 14:02:10
MySQL
ValeraValera, 2017-08-02 14:02:10

How to select multiple fields from different tables in one MYSQL query?

In place of the inscription, the quote value must be displayed the value of the `bet_val` field from the `wp_konkurs_bets` table.
How can I select fields from different tables in one query? Or what other way can you think of? common field for both tables `user_time` (wp_konkurs) and `bet_date` (wp_konkurs_bets)

<tr>
        <?php
        $userLists = $wpdb->get_results( 'SELECT user_name, user_bet, user_time FROM wp_konkurs WHERE `user_vinner` = "1"   ORDER BY user_time DESC ');
        foreach($userLists as $count):
                    $show_date = date('Y-m-d', strtotime($count->user_time));
          echo "<tr>
          <td>  $show_date </td>
          <td> $count->user_name  </td>
          <td> $count->user_bet  </td>
          <td> ЗНАЧЕНИЕ КОТИРОВКИ</td>
        </tr>";
        endforeach;  ?>
      </tr>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question