How can I use insert into with where clause
Hi
I have this script that works directly (mySql)
INSERT INTO at_crc_tratamento_manual
(dia, nif, tribunal, processo, citacao, certidao, juizo, nome, sf)
SELECT
dia,nif,tribunal,processo,citacao,certidao,juizo,nome,sf
from at_crc_reclamacao_de_creditos
WHERE processo = '441/12.0TBTND . 1';
How can I use db Class with it.
Something like that, but just find the correct terms
$id = $db->insert ( at_crc_tratamento_manual , $array )
You can also use this:
$db->rawQuery( 'INSERT INTO at_crc_tratamento_manual (dia, nif, tribunal, processo, citacao, certidao, juizo, nome, sf) SELECT dia,nif,tribunal,processo,citacao,certidao,juizo,nome,sf from at_crc_reclamacao_de_creditos WHERE processo = '441/12.0TBTND . 1' )
Ok! Thank You I have in mind something like that you (thanks) give:
$wSQL = "SELECT * FROM xxx WHERE yyy"; $data = $db->query( $wSQL );
It should return the same, but I realy didn't found something more like tradicional queries (using $db of course) $resposta['data'] = $db ->where('processo', $p ) ->get(DB_PRE.'crc_tratamento_manual tbl', null, 'DISTINCT tbl.*'); Understand? But the important is have a way, a solution, and i got it. Thank you so much
In Time Obrigado desde Portugal - Viseu
Hi,
you're welcome but it is $data = $db->rawQuery( $wSQL );
But for a better solution i don't know for your query. Maybe @ThingEngineer you can help here?
Of course. My mistake. Thank you