从mysql获取数据

时间:2018-05-21 09:30:05

标签: java mysql

我有三张桌子.green-circle { height: 20px; width: 20px; background-color: green; border-radius: 50%; display: flex; align-items: center; justify-content: center; /*margin-left: 40px; margin-right: 40px;*/ /*margin-top: 10px;*/ }。用户可以同时在几个组中。如何在一个声明中获取<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> <table id="tblRandomSummary" class="table table-hover table-striped table-bordered table-condensed responsive no-footer dtr-inline dataTable collapsed" role="grid" aria-describedby="tblRandomSummary_info" style="width: 1029px;"> <thead> <tr role="row"> <th class="sorting_asc" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 47px;" aria-label="Circuit: activate to sort column descending" aria-sort="ascending">Circuit</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 71px;" aria-label="WashType: activate to sort column ascending">WashType</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 115px;" aria-label="AverageDuration: activate to sort column ascending">AverageDuration</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 71px;" aria-label="FirstRinse: activate to sort column ascending">FirstRinse</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 143px;" aria-label="CausticRecirculation: activate to sort column ascending">CausticRecirculation</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 125px;" aria-label="IntermediateRinse: activate to sort column ascending">IntermediateRinse</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 123px;" aria-label="AcidRecirculation: activate to sort column ascending">AcidRecirculation</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 126px;" aria-label="IntermediateRinse: activate to sort column ascending">IntermediateRinse</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 0px; display: none;" aria-label="HeatSterilizeNoPulsing: activate to sort column ascending">HeatSterilizeNoPulsing</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 0px; display: none;" aria-label="HeatSterilizePulsing: activate to sort column ascending">HeatSterilizePulsing</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 0px; display: none;" aria-label="SecondSemiAutoRecirculation: activate to sort column ascending">SecondSemiAutoRecirculation</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 0px; display: none;" aria-label="SanitiserRecirculation: activate to sort column ascending">SanitiserRecirculation</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 0px; display: none;" aria-label="FinalRinse: activate to sort column ascending">FinalRinse</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 0px; display: none;" aria-label="Idle: activate to sort column ascending">Idle</th> </tr> </thead> <tbody> <tr role="row" class="odd"> <td tabindex="0" class="sorting_1">Engine001</td> <td>Acid</td> <td>3.75 mins</td> <td>0</td> <td><div class="green-circle">0</div></td> <td>0</td> <td>0</td> <td>0</td> <td style="display: none;">0</td> <td class="red-circle" style="display: none;">4</td> <td style="display: none;">0</td> <td style="display: none;">0</td> <td style="display: none;"></td> <td style="display: none;">0</td> </tr> <tr role="row" class="even"> <td tabindex="0" class="sorting_1">Engine001</td> <td>SemiAuto</td> <td>3.75 mins</td> <td><div class="green-circle">0</div></td> <td><div class="green-circle">0</div></td> <td>0</td> <td>0</td> <td>0</td> <td style="display: none;">0</td> <td class="red-circle" style="display: none;">4</td> <td style="display: none;">0</td> <td style="display: none;">0</td> <td style="display: none;"></td> <td style="display: none;">0</td> </tr> <tr role="row" class="odd"> <td tabindex="0" class="sorting_1">Engine001</td> <td>SemiAuto &amp; Acid</td> <td>3.75 mins</td> <td><div class="green-circle">0</div></td> <td><div class="green-circle">0</div></td> <td>0</td> <td>0</td> <td>0</td> <td style="display: none;">0</td> <td class="red-circle" style="display: none;">4</td> <td style="display: none;">0</td> <td style="display: none;">0</td> <td style="display: none;"></td> <td style="display: none;">0</td> </tr> <tr role="row" class="even"> <td tabindex="0" class="sorting_1">Engine001</td> <td>No Wash</td> <td>4.13 mins</td> <td><div class="green-circle">0</div></td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td style="display: none;">0</td> <td class="red-circle" style="display: none;">4</td> <td style="display: none;">0</td> <td style="display: none;">0</td> <td style="display: none;"></td> <td style="display: none;">0</td> </tr> <tr role="row" class="odd"> <td tabindex="0" class="sorting_1">Engine001</td> <td>Rinse</td> <td>4.44 mins</td> <td><div class="green-circle">0</div></td> <td><div class="green-circle">0</div></td> <td>0</td> <td>0</td> <td>0</td> <td style="display: none;">0</td> <td class="red-circle" style="display: none;">4</td> <td style="display: none;">0</td> <td style="display: none;">0</td> <td style="display: none;"></td> <td style="display: none;">0</td> </tr> </tbody> </table>特定users(id, login), groups(id, name), users_groups(user_id, group_id)

1 个答案:

答案 0 :(得分:-1)

SELECT groups.name FROM groups WHERE groups.id in ( SELECT rel.group_id FROM users_groups rel WHERE rel.user_id = 'your_user_id' );