Closed zehenrique08 closed 4 years ago
I have the same problem!!
Hi there.
$h
->table('quantos as a')
->select([
'a.idproduto as id',
'b.name as nome',
'b.valor as valor',
'b.qauntidade as qauntidade',
])
->innerJoin('produtos as b', 'a.idproduto', '=', 'b.id')
->where('a.idcliente', 37)
->get();
produces the following query:
SELECT `a`.`idproduto` AS `id`,
`b`.`name` AS `nome`,
`b`.`valor` AS `valor`,
`b`.`qauntidade` AS `qauntidade`
FROM `quantos` AS `a`
INNER JOIN `produtos` AS `b` ON `a`.`idproduto` = `b`.`id`
WHERE `a`.`idcliente` = ?
Is this what you are trying to achieve?
Hi
$dados = Quanto::select([
'idproduto as id',
'b.name as nome',
'b.valor as valor',
'b.qauntidade as qauntidade',
])
->innerJoin('produtos as b', 'idproduto', '=', 'b.id')
->where('idcliente', $id)
->get();`
could you really give me an example using Static method?
The class Quanto
is not a part of hydrahon so without further information I cannot help you here. The only thing I see is that there is no table provided?
hello friend thank you for having answered, about 'Quanto' he and referring to the table created there in the database
for me to do simple select in the table I do like this
Quanto::select()->get();
instead of so
$h->table(quanto)->select()->get();
already got a friend thanks for responding with your code got a better understanding of the inner join syntax
$dados = Quanto::select([ 'idproduto as id', 'b.nome as nome', 'b.valor as valor', 'qauntidade as qauntidade', ]) ->innerJoin('produtos as b', 'idproduto', '=', 'b.id') ->where('idcliente', $id) ->execute();
Im closing this Issue now. Let me know if the issue persists.
I am not able to reproduce following sql using HYDRAHON
SELECT a.idproduto AS id ,b.nome AS nome ,b.valor AS valor ,a.qauntidade AS qauntidade FROM
quantosa INNER JOIN produtos b ON a.idproduto = b.id where a.idcliente = 37