Questions tagged as 'mysql'

1
answer

SUBCONSULTATIONS IN SQL?

Using the DB below, how would you return the name of the person you rented on the date '2016/11/17'. Name is in the person table and the date in the loan table. CREATE DATABASE escola; USE escola; CREATE TABLE IF NOT EXISTS acervo ( id in...
asked by 18.11.2016 / 13:24
1
answer

Sort result of a query with JOIN based on the number of records of one of the tables

Assuming I have two tables in my database ( pedidos and pedidos_itens ) how can I get the data from the orders sorted by the orders that contain the most items? I have tried to do a Right Join , but I do not know what to use i...
asked by 17.11.2016 / 13:07
1
answer

mysql Rank grouped function for a COUNT

I have 3 tables in MYSQL represented here as an example: IneedaquerythatreturnsaRANKofcontractsexecutedgroupedbycommercialinagivenperiodoftime,forexample:AquerythatreturnstheRANKofthecommercialsbetween2016-01-01and2016-01-03,shouldlookliketh...
asked by 04.12.2016 / 17:50
2
answers

Enter a Date Range

Good morning, I'm doing a system that needs to record the presence of users in an event, separating by date and time period. The part of the period was simple, but the date I got a problem, I need to get the date of the form that inserts the Sta...
asked by 14.11.2016 / 14:14
1
answer

Select with subquery transforming into column

Well, I did not know how to put the title ... Anyway, I have the table tblnotadisciplina (following image) that will store students' notes of a certain period. These grades have an evaluation type (1-Work, 2-Test). I want to make a query wh...
asked by 01.02.2017 / 01:38
1
answer

Summaries and db Reformatting for a DataGridView

Probably did not elaborate a correct title, but I will try to explain my detailed question. I'm working with WindowsForm in VisualBasic15 I need to make a form where I can get data from tb to db . But I do not just want to...
asked by 01.02.2017 / 14:58
2
answers

How to find the second largest number

I need to get the photo with the second highest salary <?php $host = "localhost"; $username = "root"; $password = ""; $db = "imagem"; mysql_connect($host,$username,$password) or die("Impossível conectar ao banco.");...
asked by 31.01.2017 / 18:37
1
answer

Mysql ignore accents

I'm in a project with bootstrap and php + mysql. In it I have a simple search: $y = mysql_query("SELECT *,date_format('ultimologin','%d/%m às %H:%i') as 'ulogin' FROM $tabela WHERE estado='$estado' COLLATE utf8_general_ci ORDER BY ultimologin...
asked by 25.09.2016 / 17:19
1
answer

Relationship of two tables

Well, I have two tables and I need to relate them. I'm doing it this way: SELECT lancamentos .* FROM lancamentos INNER JOIN clientes ON lancamentos.cliente_id = clientes.id ORDER BY clientes.nome ASC But I need to bring the n...
asked by 30.08.2016 / 22:05
2
answers

Confirmation question before inserting into the database

I have the following insert page: <?php include("conn_sys.php"); $setor = $_POST ["setor"]; $fornec = $_POST ["fornec"]; $desc = $_POST ["desc"]; $id_usuario = $_POST ["id_usuario"]; $login = $_POST ["login"]; $n...
asked by 22.08.2016 / 23:27