Questions tagged as 'join'

1
answer

How to check, in the middle of a select, relationship existence of a record of a table A with records of other tables

I notice that I am a beginner and may be asked something simple, but come on. I have two tables, PROMOTIONAL and PRODUCTS, where a PRODUCT can relate to zero or many PROMOTIONAL records. What I need is, when I make a select in product, I also b...
asked by 29.09.2017 / 14:55
1
answer

Query Linq C #

Good afternoon I have the following database structure: Tables: -User -Group - Permission And all relations N to N: User Group User Permission PermissionGroup I made a query to return the user, regardless...
asked by 30.01.2017 / 14:57
1
answer

Using SUM () in mysql returning incorrect value

I'm having trouble building an sql that returns the sum of the entries and the sum of the outputs correctly. I have tables tbl_produtos(id_produto,NomeProduto) , tbl_entradas_produtos(Id_produto,QuantProdutos,Estoque,ExcluirProdutoEnt)...
asked by 02.08.2016 / 18:14
0
answers

JPAUpdateClause with Join

I have the following entities: @Entity @Getter @Setter @NoArgsConstructor @Table(schema = "MYDB", name = "TB_TESTE") public class Teste implements Serializable { @ManyToOne @JoinColumn(name = "CO_TIPO_TESTE") private TipoTeste tbT...
asked by 28.07.2016 / 19:40
1
answer

Help with inner join: "No space left on device"

I'm not very knowledgeable in SQL programming and experience, however, I need to do a search on a PostrgeeSQL database (I'm using pgAdminIII) where I need to join two tables. create table table_new as select table.x1, table.x2, table.x3, tabl...
asked by 11.06.2016 / 21:10
2
answers

Problems in a SQL query [closed]

Hello, In the following query, an error is encountered in the execution: select fto.id_taxon, fto.cd_sexo as fto_cd_sexo, fto.cd_idade as fto_idade, x.ftv_cd_sexo, x.ftv_cd_idade, x.id_fv from tb_foto_oco...
asked by 23.12.2015 / 15:37
0
answers

Format JOIN result object

[PROFESSORES] id | nome | 1 | Gilson | [CURSOS] id | nome | professor_id 1 | Photoshop | 1 2 | AutoCad | 1 I would like the result of my SELECT to come in the format: (Not necessarily or exactly the same, I just want to gro...
asked by 09.11.2015 / 18:12
2
answers

INNER JOIN with equal fields in a table - Error: # 1066 - Not unique table / alias: 'tb_user' [duplicate]

I have 3 tables as follows: Intb_user,Ihavetwotypesofusers(buyer,seller)inanENUMfieldtodifferentiatetheusertype.IntheshoppingcartIhavetheuserIDs,product,andtransactionnumber.Ilink2timestotb_usuariotoknowwhoboughtandwhosold.IwanttoperformaS...
asked by 27.11.2016 / 19:33
1
answer

Add open installments with Join

I have two tables, Cliente and Parcela . The Parcela table has id do cliente as foreign key, a pagamento column that is null or contains the payment date in date format and a valor column th...
asked by 04.09.2018 / 15:19
2
answers

How to query data from a table using INNER JOIN in a subquery in PHP

I have the following SELECT to select data from a table ( chat ) on a chat system: SELECT * FROM (SELECT * FROM chat WHERE id_chat = '$chat_id' ORDER BY id DESC LIMIT 10) S WHERE id_chat = '$chat_id' ORDER BY id ASC LIMIT 10 Th...
asked by 12.01.2016 / 00:49