Questions tagged as 'sql'

1
answer

Accumulate results of a COUNT

I have a product sales table with fields sales_id , date and product . This query: SELECT DAYOFYEAR(fecha),COUNT(*) as con FROM ventas WHERE YEAR(fecha)=2016 GROUP BY DAYOFYEAR(fecha) I get the following result: DAYOFYEAR(fecha) c...
asked by 24.07.2016 / 21:05
1
answer

How do I calculate the variance of an age group in sql?

Hi guys, I hope you can help me, I have tried to get the variance of a "users" table. The field "Age" is not as such, I calculate the age of each user in the following way: select trunc(months_between(sysdate,FechaNac)/12) edad from usuarios...
asked by 11.10.2016 / 06:33
2
answers

Select the values of a row only once when a certain value of a column is repeated

I have this table and I need to select certain rows only once, according to the three different values of the column "hours" that can be seen: Keep in mind that no will know the values of the hours column to make the query, then you c...
asked by 18.10.2016 / 23:36
2
answers

How to use several "IF" Conditionals in a Store Procedure in SQL Server

I would like to know how I can use several IFs in a Store procedure in SQL Server, How would Syntax be? Here I have an example of one, but this has only one If and one Else and within that ELSE there are two others, but I need to do more and it...
asked by 16.11.2018 / 17:36
1
answer

Get procedure OUTPUT and save in a txt

You can help me the result of a output save it in a .txt using C # and SQL SQLServer create table Dedito ( ruc nvarchar(11), nom varchar(max), asd varchar(max), ddd varchar(max) ) go insert into Dedito values('20532803749','danilo'...
asked by 25.09.2018 / 22:34
2
answers

Show first word of a field in SQL

I have the need to get the first word of a data from the table. I have searched for information but I only see to get the characters you want. <?php $usuario = $_SESSION['username']; $pass = $_SESSION['password']; $results =...
asked by 04.09.2018 / 12:41
1
answer

Click counter with ajax and PHP

I would like to know if you have an example of how to count a click in a label <a></a> and that% click is stored in a database so that after the total number of times clicked is counted. < br> In the network you...
asked by 09.08.2018 / 18:58
1
answer

Format to show Query response in MySQL

I would like to know if there is a way to get the last two weeks and its amounts in SQL, I explain: The following query brings me the last two weeks with its quantities of the same product: $first = strtotime('last Monday -14 days');...
asked by 01.09.2016 / 14:54
1
answer

Consult with Like to search for characters that are not within A to Z

I find myself doing a search in my database. The search consists of finding rows with characters that do not belong to the alphabet (from the 'A' to the 'Z' ) for example 'Þ' , '%' or an Ampersand ' & '. In...
asked by 31.05.2018 / 00:35
2
answers

Add with SQL conditions

I am learning SQL and I have a database with two empty columns, Suma , Producto and I want to add the attributes of the selected names (I put a * so that they know which one I select) and I want to put a condition to my sum a...
asked by 08.07.2018 / 03:35