Questions tagged as 'sql'

2
answers

How to put 2 select in mysql

I have 2 select which are basically identical, changing only 1 table. I'm trying to put the 2 in a single select, but I'm not getting it. Follow the select: SELECT DISTINCT a.id, a.unidade, a.posicao,...
asked by 03.02.2017 / 17:37
3
answers

RETURN THE SUM OF MAXIMUM 3 VALUES IN SQL

I have a table and need to return the following: check based on the recipient column, add up the 3 largest amounts of that recipient, bring in the query only if the sum of the 3 largest are > = 1024: CREATE TABLE TRANSFERS( SENDER VARCHAR2(...
asked by 12.06.2018 / 19:56
2
answers

Time between (between) "start time" and "end time"

I'm having problems catching the current time, in case I'm using CURTIME () , I need to fetch the results that the current time is between the time value of the start time and final time , I tried the following ways, however, without success...
asked by 12.09.2014 / 04:45
1
answer

SQL Query on Loops is good practice?

Is query set with Where or other sql commands inside loops like Foreach good practice or not recommended at all? Is there a better way to handle the data without having to make so many calls in the database?     
asked by 30.07.2014 / 14:11
4
answers

month / year SELECT in DATES

I need the select to return all rows that were entered in July 2010, as shown in the example, regardless of the day. How do I return this query? SELECT * FROM FRCAST WHERE DATA_ID = TO_CHAR('07-2010', 'mm-yyyy');     
asked by 17.03.2017 / 18:10
3
answers

Why does GROUP BY not work with MySQL in this case?

I'm using the MySQL language and am trying to group a profession table with GROUP BY through the query below. SELECT name, occupation FROM OCCUPATIONS GROUP BY occupation; But I get this error when trying to group the professions....
asked by 02.12.2017 / 19:37
1
answer

Reset Auto-increment SQL Server

Good morning, I created a new table in SQLServer and I'm testing some scripts to popular the table and I came across the following situation, in my tests I'm doing the insert in the table checking the information and if they do not agree I ma...
asked by 22.02.2018 / 16:29
3
answers

Query on sql query

I have a question. I think it's not very complex, but I could not solve it. For example, I have this query: select * from Paciente where ClinicaID = 3 Your result would be these 3 records: NomePaciente HoraAtendimento Ativo Clinica...
asked by 28.11.2017 / 23:55
3
answers

Copy bank record

I used the following query to attempt to 'copy' a record insert into valores select * from valores where id = 1 However, I get the following message:    An explicit value for the identity column in table 'values' can only be specified wh...
asked by 13.04.2015 / 21:18
1
answer

Apostroph within echo

Good, I'm trying to put the pictures on the slide, but the apostrophe is breaking, where is the error? edited below the summary after the tests that I did even using the \. meu codigo atual echo "<div class='fill' style='background-image:ur...
asked by 15.04.2015 / 01:33