Questions tagged as 'sql'

2
answers

Select with group by

I want to group the results that have the same name(varchar) and count the value(int) of the different key_id(varchar) . Example, if the records were these: Theresultswouldbethese(rememberingthatthekey_idvalueis"random...
asked by 09.10.2017 / 09:59
2
answers

SQL Filter (Result that should not appear)

is the following I'm creating an online schedule and I need to list them and show the schedules that are not scheduled, to show the free time. And for this I created the scheduling_table, where in the column schedules_fixes the list of schedules...
asked by 18.10.2016 / 16:10
2
answers

Direct query subtraction of a view?

I have view dbo.ViewExportItensNotasFiscais , I have the NFValIcmsSubs field, where it is necessary to subtract the value of the NFValFCP field and keep the column name as NFValIcmsSubs How could I do a direct su...
asked by 31.05.2017 / 16:15
1
answer

Problem inserting file name into database

I'm uploading files with plupload using codeigniter. My problem is when there are special characters in the file name. Being that I have to record this original name. When there is for example: 'copy' is saved in the database: 'copy' Every...
asked by 10.02.2015 / 13:10
1
answer

Get result of a query, converting field DateHora to local time zone

I have a table in the sql server database that has the following DataHora field where I have data included in this format: DataHora 2015-04-20 17:43:04.000 This time is not in the format of our time zone. I need to make a query that...
asked by 22.04.2015 / 15:52
2
answers

Query in table with self-relationship

I have the following table containing auto-relationship between columns category and parent: idcategoria categoria pai 1 Camisetas 0 2 Regata 1 When an added category does not have a parent category, the column...
asked by 16.12.2014 / 21:04
3
answers

reduce size of an image that is in the database

I have a table that shows the contents of a database, one of the contents is an image, I call the image as follows: <td><?php echo '<img src="data:image/jpeg;base64,'.base64_encode( $books->Image ).'"/>'; ?> </td>...
asked by 23.04.2017 / 22:41
4
answers

SQL - Sorting Random Lines

Given the table as an example: I want to sort, between the lines with the same order number, a single line, that is, one of order 1, one of order 2 and one of order 3, randomly. I need a generic solution, which applies to a table with...
asked by 27.07.2017 / 15:53
2
answers

How to avoid SQL Injection in my PHP application? [duplicate]

Explanation: Most applications using PHP should be given parameters, by $_GET or $_POST , and these parameters often become an easy target for users with bad intentions, and this is called SQL Injection. Question: I would...
asked by 18.03.2014 / 21:52
4
answers

How to keep 'order' column in sequence even after an edit of the order of records?

I have a table with n fields, one of which is the 'order' (obviously it is sequential: 1, 2, 3, n ...): id | ordem | nome ------------------------ 1 | 1 | Fabio 3 | 2 | Gilmar 2 | 3 | Rodrigo 9 | 4 | Marcos...
asked by 28.03.2014 / 17:32