Questions tagged as 'sql'

3
answers

Join error of two tables. By doing a group by and ordering order by timestamp date

I need to know why you answer me as I need a query, I have a table of medical data and another of patients where two strings called id are not referenced or anything. my medicals table. +--------------------------------------+---------+----...
asked by 05.04.2017 / 23:24
0
answers

SQL - Create a match matrix

Good afternoon, This question would be the next step to the question asked in " Doubt in complex grouping sql " and that a solution was already obtained. I summarize it and indicate the new question. I have a table with tickets like this,...
asked by 10.04.2017 / 16:16
0
answers

Export Tables from a DB to an Excel with one sheet per table

Hello gentlemen, I'm looking for Export the Tables of a DB (No matter the engine, I care that you can) to an Excel with one sheet per table . Example: a single file called gastos.csv that inside contains a sheet for each table that...
asked by 04.05.2017 / 20:13
3
answers

Make a DISTINCT only in one column?

I want to do a DISTINCT but only apply in a column because I consult two things, an ID and an image and I just want you to show me an image of that product. I try to keep it that way. | producto | imagen | |----------|--------------...
asked by 06.08.2017 / 04:36
1
answer

SQL - Group query result in a field

I am programming a script in php and I have created the following query: SELECT t2.id_usuario, t3.nombre, to_char(t1.fichaje_fecha, 'YYYY-MM') AS mes ,SUM(CASE WHEN t1.operacion = '+' THEN t1.tiempo ELSE '00:00:00' END ) AS "positivo" ,SUM(CAS...
asked by 24.03.2017 / 17:43
1
answer

Group By in Laravel with SQL Server

I have the following query in Laravel through query builder: $objective_risk = DB::table('objective_risk') ->join('objectives','objectives.id','=','objective_risk.objective_id') ->join('risks','risks.id','=','...
asked by 28.03.2017 / 15:14
1
answer

Insert "/" into a SQL column to format it for date

A client sent me their database in which dates are included, however they come with a YYYYMMDD format, and I would like to create a "query" where I can insert the "/" delimiter in that column so that it remains this way YYYY/MM/...
asked by 17.03.2017 / 02:13
1
answer

Error creating an Identity in Oracle

How about people, I hope you can help me solve this problem even if it's silly, I'm trying to create a table with an Identity type ID and I'm getting the following error: Error que empieza en la línea: 1 del comando : CREATE TABLE USUARIO ( us...
asked by 05.05.2017 / 18:54
2
answers

Access to SQL file from Java and DriverManager

I have a database file SQL that I want to access from a Java class that makes the connection to DriverManager and JDBC , but I'm a bit lost. the file is called items.sql DBItem.java package beans; import java.sql.*;...
asked by 23.03.2017 / 09:47
1
answer

Annual SQL query grouped by dates

I need to make an annual consultation grouped by months of all registered users in the period of one year. The query would be the following: SELECT COUNT(*) AS total_users, YEAR(created_at), MONTH(created_at) FROM 'users'...
asked by 23.03.2017 / 13:03