Questions tagged as 'sql'

3
answers

Split_String in SQL and use its values

I have a very simple operation, but I do not know how to proceed. In a Stored Procedure I get a string full of Id's separated by commas, so I need to separate that string and use its content within a INSERT . But I do not know how to use...
asked by 31.08.2018 / 01:28
2
answers

SQL query between two SQL SERVER tables

I have two tables (tb_Product_M and tb_Product_Product) that presents a recursion, where a Product can have several Product children. In the table tb_Product_Product contains the data of the parent_Product_id that Products children has this. I n...
asked by 31.08.2018 / 21:16
1
answer

Apply a WHERE to my SQL statement in a selective and total SUM

guys I have the following conflict: I have the following SQL statement SELECT SUM(monto) AS 'total', SUM(CASE WHEN status_pago = 'PENDIENTE' THEN 1 ELSE 0 END) AS 'pendiente', SUM(CASE WHEN status_pago = 'APROBADO' THEN 1 ELSE 0 E...
asked by 10.10.2018 / 04:43
1
answer

SQL query in MySQL between 3 tables

I have in MySql 3 tables, of which 1 contains the code of the other two tables I try to make a select that shows me the first table and instead of the ID of the other 2 tables show me the corresponding name tabla_1 int id_tabla1 varchar nombre...
asked by 29.07.2018 / 02:52
3
answers

Help with query sql server 2008 pls

I have a table called usuarios which has several fields, one of them is the field estado_usuario which has as parameter 0, means the user is disabled and 1 which means that the user is valid. I need to count the number of curren...
asked by 01.10.2018 / 17:40
1
answer

How do you load data from ajax when the page loads?

What I want to do is that when entering the page, a table with the information of the users is loaded, but using JS, I do not like to put PHP code in the HTML, the question is that I do not know how to apply it through ajax, Data will be sent, w...
asked by 28.07.2018 / 02:13
2
answers

Can I form a WHERE in a variable of @?

A question, Can I put the condition (WHERE) in a variable? where does it contain all the conditions and use it at the end of my SP? If it is possible, how could it be done? something like SELECT * FROM TABLA WHERE fecha = @condiciones; W...
asked by 06.08.2018 / 22:11
2
answers

Error inserting new column with MySQL

I have a small script in which I want to insert a new column into a table in the database. This is the content of the file myscript_ddl.sql : START TRANSACTION; ALTER TABLE e1qxp_productos ADD COLUMN 'cierre_venta' TINYINT(4) NULL DEF...
asked by 17.05.2018 / 13:23
2
answers

Group and have the data with the autoincremento mayor- SQL

I need to search in a database like this, where "id" is the variable with autoincrement: id device 6 1 5 1 4 2 3 2 2 1 1 1 I need to sort by "device" but it gave me when "id" is minimal, I need to group w...
asked by 24.10.2018 / 02:57
3
answers

Take sql data and mark it as active or current

I want to do this in php maybe I can not explain myself well so if you need to modify it do not worry I can do it quickly since I feel in my pc I have a table with only 2 variables (ACTIVE) and (NOT ACTIVE) $sql = mssql("select estado from...
asked by 26.01.2017 / 12:52