Questions tagged as 'sql'

1
answer

Use the COUNT () function and a WHERE in the same Query

I have the following query: SELECT COUNT(IDPROVEEDORES), IDPROVEEDOR FROM PROVEEDORES WHERE COUNT(IDPROVEEDORES) > 1 But I get the following error:    Incorrect syntax near the keyword 'where'.     
asked by 22.05.2018 / 23:53
2
answers

Error inserting data into a table in SQL Server 2008

I have a problem with the insertion of the following data in the following table: CREATE TABLE TB_ADMIN_MONITOREO ( FECHA_PROCESO NVARCHAR, FECHA_EJECUCION DATETIME, SERVIDOR NVARCHAR, UNIDAD CHAR, [LIBRE...
asked by 23.04.2018 / 23:16
3
answers

SQL query to two tables

Good morning everyone! I want to do an SQL query that retrieves all the fields from the PRODUCT table whose id field is found in the SALES table, the SALES table has the following fields: ProductID, idVenta, Observation and the table PRODUCT...
asked by 23.02.2017 / 15:48
1
answer

Number of Open Cursors in SQL SERVER 2000

Has anyone any idea how to check the number of open cursors in a SQL SERVER 2000 database? Thank you.     
asked by 13.07.2018 / 17:44
1
answer

Difference between count (*) and count (column-name)

When I was practicing SQL queries, I had a question with the way of doing one. I would like to know what is the difference between:    SELECT open_date, COUNT (*) FROM accounts with this other    SELECT COUNT (open_date) FROM accounts...
asked by 03.02.2018 / 15:53
1
answer

Sql - How to prevent the empty fields of my form from appearing as undefined when doing the query?

Hi, I have the following problem with a query, I have a form that I upload to my bd but the user has the option not to fill in all the fields, the problem is that in my table the fields that are varchar are uploaded as undefined when the user up...
asked by 21.08.2017 / 15:41
4
answers

Increase Id with an INSERT in SQL Server

I have a table with different fields, I want to do a INSERT in which the new sentences have the Id from the last one. How could I do it? I thought about doing something like this: insert into id = id + 1 But I'm not conv...
asked by 22.08.2017 / 09:41
3
answers

Error in Sequelize SQL query

I have this query: where: { $or: { $and: { mes: mes, any: any }, $and: { dia: 1, mes: 1 + Numbe...
asked by 10.03.2017 / 18:36
2
answers

In SQL query check if a dateA field is equal to "01/01/1900" and if so it returns the value of another dateB field

I have a very long SQL query in one of its paragraphs I need to control if a field dateA is equal to "01/01/1900" and if so it returns the value of another field dateB. As I commented the query is very very long with other CASE, arguments, et...
asked by 05.09.2018 / 11:56
2
answers

Cascade delete in MySQL with DELETE

I have 3 tables in my MySQL database. Clientes (existe el DNI) Clientes_compra (puede existir el DNI o quizás no). Clientes_alquiler (puede existir el DNI o quizás no). My intention is to ask for a Java program the textfield_DNI and...
asked by 19.01.2017 / 22:46