Questions tagged as 'sql'

1
answer

Return fields from parameters

Good evening, I need the return of a SELECT to be dependent on the parameter that is passed in SELECT Example declare @variavel nvarchar (50) Select          field          campob,          campoc,          campod,          campoe, f...
asked by 03.05.2016 / 02:56
1
answer

Saturation of foreign keys?

After a long time with non-relational database I decided to go back and I came across a strange situation. My application is a simple chat where this chat has sub rooms. I made a small demonstration: I need the user id in the room to kn...
asked by 03.05.2016 / 15:13
3
answers

How to remove the last character of a field in Firebird SQL

I have a field in a table that should only contain 4 characters, I noticed that it is 5 characters and the last one is the number zero. Example: Código Errado: 45380 Código Correto = 4538 Can you delete the last character of a field in F...
asked by 31.03.2016 / 02:30
1
answer

Problem inserting records in Oracle

I'm having trouble inserting records into Oracle, below is the insert I use: insert into COMPRAS (id, valor, data, observacoes, recebido) values (id_seq.nextval, 200, '19-FEB-2008', 'MATERIAL ESCOLAR', '1'); However, it generated thi...
asked by 17.01.2016 / 11:23
1
answer

Difficulty with PDO

I'm starting with the use of PDO and I have a question I could not solve. I do the select below that will return me 2 times: $sqlSaida = 'SELECT horario FROM HORARIOS WHERE COD = :codsaida UNION...
asked by 04.12.2015 / 19:02
2
answers

Search by date php pdo

I need to search the database using the DtBase column, for example: on day 26 I populated the table with several information, on day 28 I want to see what I did on day 26. I want an input date or another method that it is more feasible for me...
asked by 26.01.2016 / 16:34
3
answers

How to group results in a row?

I would like to perform a query on the FILE_EXAME table with the following data: CREATETABLEFICHA_EXAME(FICHAsmallint,EXAMEVARCHAR(15));INSERTINTOFICHA_EXAMEVALUES(1,'Hemograma');INSERTINTOFICHA_EXAMEVALUES(1,'Colesterol');INSERTINTOFICHA_EX...
asked by 10.12.2015 / 14:28
1
answer

Query the most duplicate record

I'm having a problem retrieving the teacher who teaches more subjects in this table, in that case I want to retrieve the code that most has double records in the cod_prof column. create table aluno_professor_disciplina ( matricula int,...
asked by 23.11.2015 / 19:01
1
answer

How to write the value with decimals before the point in the sql server?

I have a field in the bank with this format TESTE numeric(8, 3) I want to record this form. UPDATE TB_PLANO_CONTAS SET TESTE = 001.000 WHERE IDPLANOCONTAS = 63 The result looks like this: 1,000 UPDATE TB_PLANO_CONTAS SET TE...
asked by 13.11.2015 / 18:18
2
answers

How to concatenate the results of a RELATIONSHIP in a SELECT?

Since the tables PRODUTO , CATEGORIA and a CATEGORY can have several PRODUCTS , I'd like a select to be listed in a nvarchar column All PRODUCT.NAME of a CATEGORY . Something like: select concat( select p....
asked by 11.02.2016 / 18:31