Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function get_circuit()
- {
- $arg = null;
- if(isset($_GET['id'])) {
- $arg = array($_GET['id']);
- $where = ' AND Devices.id=?';
- }
- $sql="
- select Devices.Name, Devices.CustomNum, lns.* from Devices
- inner join (SELECT Devices_id, group_concat(
- concat_ws( \",\", if(Switch=0,\"\",concat(\"S\",Switch)), concat(Phase,
- case
- when `Type`=1 then \"U\"
- when `Type`=2 then \"I\"
- when `Type`=3 then \"K\"
- else \"P\"
- end
- ))) as qs from `Lines` group by 1) as lns on lns.Devices_id=Devices.id
- where Devices.`Type`=1 $where
- having qs LIKE '%S%'
- order by CustomNum, `Name`
- ";
- $this->run_query($sql, $arg, ['Devices', 'Lines']);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement