Tenho uma consulta para selecionar dados de várias tabelas. Como faço para escrever seu código equivalente em codeigniter. Veja a consulta:
select *
from A inner join B on (A.ad_no=B.ad_no)
where B.ad_no in (select ad_no
from A
where $staff!='00:00' and $staff!='0:00')
order by B.ctype asc, B.cname asc,B.ad_no asc
Tentei uma consulta no codeigniter, mas está demorando mais para carregar o resultado.
Você pode tentar o seguinte (eu removi a $
placa da equipe)
$query = $this->db
->select("*")
->from("A")
->join("B", "A.ad = B.ad_no")
->where("B.ad_no in (select ad_no from A where staff!='00:00' and staff!='0:00')",NULL, false)
->order_by("B.ctype", "ASC")
->order_by("B.cname", "ASC")
->order_by("B.ad_no", "ASC")
->get();
Você obtém uma saída gerada com a seguinte instrução
echo $this->db
->select("*")
->from("A")
->join("B", "A.ad = B.ad_no")
->where("B.ad_no in (select ad_no from A where staff!='00:00' and staff!='0:00')",NULL, false)
->order_by("B.ctype", "ASC")
->order_by("B.cname", "ASC")
->order_by("B.ad_no", "ASC")
->get_compiled_select();
Este artigo é coletado da Internet.
Se houver alguma infração, entre em [email protected] Delete.
deixe-me dizer algumas palavras