Questions tagged as 'sql'

1
answer

Selection of two fields from different tables, all in one

I have two tables in a BD. One is the table of vehiculo and another one of vehiculo_especial . vehiculo --------- pk_vehiculo modelo matricula kms_actuales prox_itv prox_revision ----------- ------- -------...
asked by 27.04.2018 / 16:25
1
answer

How to show only part of a string in sql server?

I have a table and in this one, a post column. What I need is for a query to show only the domains, that is, hotmail.com , gmail.com , etc .. SELECT correo FROM cliente     
asked by 01.03.2018 / 22:06
2
answers

How to search with several columns in one table until finding the value in another table ?, ORACLE

Very good, someone knows how to perform a search between two tables, where the first has several columns and search with all those columns until finding a result in another table, I explain: Table1 | nombre | telefono1 | telefono2 | telefon...
asked by 28.02.2018 / 16:48
1
answer

Failed to execute statement in SQL Server 2008 [duplicate]

I need to run this MYSQL statement in SQLServer CREATE TABLE venta ( idVenta INTEGER PRIMARY KEY, Fecha DATE NOT NULL, Cliente_Cedula INTEGER NOT NULL, producto_idProducto INTEGER NOT NULL, empleado_Cedula INTEGER NOT NULL, can...
asked by 02.03.2018 / 18:14
1
answer

SQL orders last quarter [duplicated]

How can I know the orders of the last quarter given this question and this relational database Would it be like this? SELECT ID_PRODUCTO FROM PRODUCTOS WHERE ID_PRODUCTO IN ( SELECT ID_PRODUCTO FROM PEDIDOS...
asked by 04.03.2018 / 18:47
1
answer

Show URL depending on database value

I have the following table in my database: I want that depending on the values of android, ios etc a different url is shown. For example if android is 1 for this user, it shows the android website. The code I have used is the followi...
asked by 25.03.2018 / 21:06
1
answer

Error 1064 SQL in query [closed]

I can not see the error of this statement create table authority ( id int GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) primary key, name varchar(50));     
asked by 12.03.2018 / 11:41
1
answer

Select the records that are not in another table

This is the logic in a project involved many users and a user participates in many projects, I have these tables projects id |name | ---|-----------| 8 |Proyecto 1 | 9 |Proyecto 2 | projects_users id |projects_id |users_id |role | ---...
asked by 26.03.2018 / 00:59
2
answers

Use "WHERE" as a subquery with INSERT

My idea is to be able to insert the sum between 2018-07-12 and 9 days ( SELECT "" + interval 9 day) ) in the column fechaFin of the same table. But first I want to identify a row of T_tarifa with where but it...
asked by 21.03.2018 / 21:29
1
answer

Sub-Query SQL server

I'm new in these parts. I'm doing an SQL query, which started as a girl and ended up making my life more complicated. I have something like this: Two tables. One has data on costs, date and ID, the other has date and exchange rate / Curr...
asked by 15.03.2018 / 18:28