Questions tagged as 'sql'

3
answers

Execute MYSQL in a bash script

Greetings community I hope you are well. I have a problem, I want to run a few MYSQL statements but as BASH , I need to run this on ubuntu. I have created a file called scripts.sh where I have placed the sentences to execute:...
asked by 17.12.2018 / 21:51
2
answers

SQL does not work, where [closed]

SELECT id, date_start, date_end as "ID" FROM project_task a inner join project_task_type b where a.date_start is not NULL and a.date_end is NULL Give error in where     
asked by 17.12.2018 / 09:17
1
answer

Get the source of the results in a COUNT

I have two tables: swipe and eclipse_hastag : Here is the table eclipse_hastag : Here is the swipe table: I want to know what are the hashtag_id that have more than state=3,6,9 I get what...
asked by 16.05.2017 / 15:35
2
answers

ALTER TABLE with new column that is foreign key MYSQL

I need to add a new column in one of my tables, but this column in turn is a foreign key from another table but I do not know how to do it ... I tried this but evidently gave me an error: ALTER TABLE ordenes ADD COLUMN ticket varchar(50) FO...
asked by 07.11.2016 / 16:07
2
answers

Group Querys in a Stored Procedure SQL

Good morning, I have a problem and I do not know how to solve it, I need to make a report, which I requested certain measurements by MES. What I have is the Query of each measurement, but I do not know how to group all these Querys through an SP...
asked by 11.09.2017 / 13:40
1
answer

Join in SQL With different tables

I have 3 tables: States, Municipalities and Localities, each with their ID, and I want to relate them to obtain to which state and municipality the localities belong, but the detail is that I have the data in the following way: When...
asked by 03.08.2017 / 18:48
2
answers

How to access multiple rows in SQL from php

When I make a query to a table that results in two rows, for example: $sql= "SELECT id, nombre, apellido FROM usuarios WHERE nombre = 'Juan'"; $res = $db->query($sql) or die("error: ".$sql); $row = $res->fetch_assoc(); and I get this...
asked by 15.12.2016 / 12:06
1
answer

Postgres: Get what part is a record within a set

Good morning, I am trying to obtain or calculate the information of each record within a set (quota and partial value), I explain it below with an example: | id_pago | fecha | valor | |:-----------|------------:|:-----:| | 910006603...
asked by 24.04.2017 / 15:37
1
answer

How to unify two tables into one?

I am working on a report which should show the information of an item, as well as its locations, the different warehouses and their current stock. Use SQL server with an openquery to get information from BaaN. What I want to do is something s...
asked by 31.03.2016 / 14:45
1
answer

Query determined by SQL ID

I have a question that I am asking, the fact is that I am very bad at doing it. My table: payments_credit With its columns: credit_pay_id, contract_id, acquisition_date, credit_credit. I try to get the LAST "id_pagos_credito" from my "cont...
asked by 07.04.2018 / 06:21