Questions tagged as 'sql'

1
answer

Use of MAX and MIN functions in postgresql

I have a table like the one shown below (simplified example): Customer_ID Orders    1 10    2 15    3 5    4 8 Now I would like to generate an extra column that is the maximum value of the Orders column, that is, in the four rows a 15...
asked by 28.09.2018 / 11:00
1
answer

Show a date that entered in JText from Java and that is stored in SQL

I would not be able to enter a date of birth in my program to fill out a file of a client and save it in the sql database from xampp, I could do it as a string but obviously it does not take the bars "/ " I want to directly load the date and sav...
asked by 06.10.2018 / 18:53
1
answer

Difference of SQL days

I have the following problem, I want you to show me in a column how many days are left until my next birthday. I already tried the following functions DATEDIFF and DATEADD I leave you my sentence that would be missing add this column: se...
asked by 02.10.2018 / 21:36
2
answers

How to use a TextBox for different SQL Server operations?

I am using WebForms, for the platform that is already working correctly in the work, in conjunction with VB.NET, I have a question on how to work with a single text field, and, in turn, the same Text field can work to store different information...
asked by 28.09.2018 / 21:58
0
answers

Duplicate a tuple by changing a field

Very good. I have a table called ALBARAN_SALES in which I must do a replica of a tuple as the following exercise asks:    REPLICATE_ALBARAN. Generate the replication of a sales slip   (including lines). The delivery note to be replicated will...
asked by 29.09.2018 / 00:41
1
answer

How is a trigger that adds a row and that is assigned in a column?

Well the fact is that I want to make a sum of a row and that this is saved in a field here of how I carry the table: the case is that when entering: UPDATE enero SET totalgastos= enero.alimentacion+enero.transporte+enero.ser...
asked by 24.09.2018 / 03:03
1
answer

SQL. Table with quarterly averages based on monthly data

I have a table with monthly numeric data fields (January to December) for several years. I want to generate a new table that contains the quarterly averages for those numeric fields for each year, so that the generated table should look like thi...
asked by 27.09.2018 / 16:46
0
answers

Kardex Get Latest Price

Good afternoon, I have the following procedure CREATE DEFINER=root@localhost PROCEDURE kardex(codigoproducto INT(5)) BEGIN SET @canant=0.00,@totant=0.00,@preant=0.00; SELECT fecha , numeroMovimiento , IF(tipoMovi=1,detalle.cantidad...
asked by 22.09.2018 / 19:10
2
answers

INNER JOIN skips a record

I would like to know what I am doing wrong, I have consulted with inner joins that should show 11 records and only show me 10, the tenth record is skipped, I do not know if I am doing wrong join or I have passed some field, I attach images and m...
asked by 28.09.2018 / 20:17
0
answers

Put table name in SQL query result

I have a question about whether this can be done in postgresql Let's say I have a table called X which has 3 fields, a, b, c If I do a select * from X it gives me the records in the form: a --- b --- c --------- Okay, so I would l...
asked by 24.09.2018 / 21:23