Questions tagged as 'union'

3
answers

tried a query with union but did not get the expected result

I made a query with two selects using union and it has two columns: MOBI and DESMOBI . I need the result to show these two columns. when I execute it only shows the MOBI 'column. Below is the query. I look forwa...
asked by 02.08.2017 / 19:40
1
answer

Laravel 5.5: Get name of each table in select union

I need to make a select in two tables and join them with union , until then, but I need to also get the name of the two so I can identify it in View . > I have tried to use getTable() in each select , but it returns the e...
asked by 23.12.2017 / 22:37
1
answer

Struct with union is giving invalid use error

I need to use union within struct , but I can not. The error displayed is    [Error] invalid use of 'union Client :: document' Struct: struct Cliente{ string nome, email; union documento{ long cpf...
asked by 18.11.2018 / 14:18
1
answer

Join two IFs or more

I need to join some if 's and I'm having trouble, I have already tried using union , but to no avail. The query I'm running is: IF (select count(Estado) FROM tbl_1 where Estado != 'WIP' AND Estado !='on hold') > 0...
asked by 20.03.2018 / 16:40
2
answers

Doubt in preparing a query in SQL

Could you tell me what's wrong with this SQL code? I want for each movie, the salaries of each staff does not appear repeated, ie if the first movie has 2 leads , in the table I want to sum these values to the lead . select Ms.salary as To...
asked by 17.12.2016 / 18:41
2
answers

Union problem in mysql

I am trying to perform a query and is giving the following error:    Unknown column 'FILIAL' in 'field list' The query is as follows: SELECT TICKET, DATAHORA, TIPO, ESTADO, CRITICIDADE, LOGIN, PARECER, INFOPEND, PROP, DATAPROP, PREV, SR...
asked by 17.07.2018 / 14:49
1
answer

Problems stopping tables with UNION

I'm trying to get the top 3 from my table and also the last 2 placed, SITE TO RUN SCRIPT This is my current progress that does not work SELECT ('Podium: ' ||TEAM) as name FROM LEAGUE ORDER BY position ASC LIMIT 3; UNION ALL SELECT ('D...
asked by 17.04.2018 / 19:48
1
answer

How to merge two results into a query conditionally

Talk, guys! Would anyone know how I can use a UNION ALL conditionally? Example: DECLARE @cond INT = 1 SELECT * FROM table1 IF(@cond = 1) BEGIN UNION ALL SELECT * FROM table2 END The idea is this but this does not work. How coul...
asked by 06.09.2018 / 04:35
0
answers

Union with different dataTypes Linq-to-entities

I'm trying to return a grid! with headers and values below. I'm trying to do this! void Main() { var ctx = dbContext; (from tQuestions in ctx.Questions select new { a1_1 = (Object)tQuestions.HeaderCreationD...
asked by 24.05.2018 / 18:28
0
answers

Alternative for using UNION in mysql / php

Good morning, I'm doing the sum of the elements of a column (which I called MyColumn) in function of another, called "shift". There are three values for shift, so I need the code to return three distinct sum values. For this, I'm using the UN...
asked by 13.03.2018 / 13:03