Select with a return of several values from several columns

2

Greetings! This is my first post, I hope I can be helped and I can also help a lot on this journey with you! So some formatting error I just ask for patience until the standards here are adequate!

Well, my first problem is being in creating a select that returns several values that are not in a single column of a table.

I need to do this to return search suggestions .. For example: If the official type: "tec" is loaded by the database the possible phrases with it: for example: common keyboard, gamer keyboard, tec_fabricant, etc ...

Maybe I have to use a nested select, but I'm still not sure:

Below is a scope of my need: Select * from tableSpecific where column_name like '% tec%';

Disregard primary key.

Sincerely.

    
asked by anonymous 25.11.2017 / 17:16

1 answer

0

I was able to solve the problem, follow the steps below for future solutions if someone needs:

SELECT colunaA as ApelidoPadrao

FROM tabelaA

Where colunaA like '%Suamensagem%'

UNION -- Esse é o cara que permite a junção

SELECT colunaB as ApelidoPadrao

FROM tabelaA

Where colunaB like '%Suamensagem%';
Ready! does with two does with more: Requires the types to be the same. However you can use a 'SELECT TO_CHAR (ColumnX) if you need to force a casting !

    
25.11.2017 / 19:49