Questions tagged as 'sql'

1
answer

How to do an SE function in SQL

Good morning. How do I make an SE function in SQL server? For example, I have data in a column and when it is = '1';'masculino';'feminino' . Can you help me out?     
asked by 14.06.2018 / 16:47
1
answer

How to "join" foreach results

I have a script to do multiple upload files in php. At the time of uploading, he wanted him to insert into the photos table the information with the names in that format: "name1.jpg | name2.jpg". The query I use to insert is this: INSERT IN...
asked by 15.06.2018 / 21:54
1
answer

How to compare two Oracle DateTime columns

I have a column where I enter a date when the event happens (local storage), and the date the event is sent to my system. The difference between the date of the event and the date of submission can not exceed 168 hours (7 days). I'd like t...
asked by 15.06.2018 / 15:37
1
answer

Doubt in an SQL query

With this DER model I would like to make an sql query that returns me the following information: Type a command that shows how many clients are single.     
asked by 15.06.2018 / 00:35
2
answers

Line break within a MYSQL query

Hello, can anyone help me with line breaks within a mysql query? The code looks like this: CONCAT('Origem -> ',vEnderecoOrigem,' \r\nDestino ->',vEnderecoDestino) The result: Origem -> Rua Exemplo Origem Destino -> Rua Exem...
asked by 17.05.2018 / 23:01
1
answer

Check how many Products were sold in the year 2017

I'm having trouble doing this query using BETWEEN this is the template     
asked by 16.05.2018 / 04:22
1
answer

Pick up repeated records from one column from another column

Hello everyone! I am facing the following problem: I want to get the amount of values that are repeated in the type_of_type column from the location column, ie get the number of records with the same disease from a single locality...
asked by 13.05.2018 / 02:20
2
answers

transform sql with subquery into query on entity

I'm needing and am having trouble getting this sql with subquery and doing the same thing in c # entity. SELECT Id,Nome, (SELECT Count(Id) FROM Pedidos WHERE Pedidos.ColaboradorId = Colaborador.Id) AS NumeroPedidos FROM Colabora...
asked by 18.06.2018 / 14:27
1
answer

SQL server error creating table

I tried to create multiple tables in SQL but 2 of them gave the same error:    "Msg 1767, Level 16, State 0, Line 72   Foreign key 'FK__movimento__codem__3118447E' references invalid table "loan". E    "Msg 1750, Level 16, State 0, Lin...
asked by 07.05.2018 / 14:50
1
answer

Relate column of one table with all other records

I have 2 tables, posts and posts_images , the post table has the fields id , title , category and images , and the posts_images table has: post_id , img_url and etc ..., / strong> of the posts table with...
asked by 05.05.2018 / 23:03