Questions tagged as 'select'

1
answer

Search for records on a certain day of the week

Personal I have the following select set temp = Conn.Execute("SELECT * FROM tbl_estacionamento ORDER by id asc") I have a table named date where I record the day of the information record, I would like to know how I can only display results...
asked by 25.03.2017 / 11:46
1
answer

Help with return in SELECT

$user = $_SESSION["usuario"]["id"]; $sel = BD::conn()->prepare("SELECT lk.*, ep.* FROM gostados lk INNER JOIN episodios ep ON...
asked by 06.01.2017 / 16:21
1
answer

Select with subquery

I have the following select: SELECT id_usuario, SUM(CASE p.tp_honorario WHEN 'Mensal' THEN (h.vl_honorario * 12) ELSE h.vl_honorario END) as valor FROM empresa_honorario as h INNER JOIN honorario as p ON p.id_honorario = h.id_honorario WHERE...
asked by 07.12.2016 / 12:14
1
answer

Relate tables to make customer recommendations?

I have a table "tanned", "commented" and "visited", every time a user likes, comments or visits a certain book on my page a record is inserted into the database for such: Tanned table: +----------------+-------------+ | id_livro | usu...
asked by 02.02.2017 / 19:14
2
answers

SELECT INSERT in Oracle using sequence nextval and group by

Good morning, guys! I'm trying to do a select insert in Oracle using a SEQUENCE in the id, but it's giving error on account of a group by in select. Dry my SQL: INSERT INTO SUP_T(ID, DESCRICAO) SELECT SEQ_SUP_T.NEXTVAL,TIPO.TIPO F...
asked by 04.07.2016 / 13:59
1
answer

Select with MYSQL when it exists in one table and in the other

I have two tables: QUIZ QUIZ_GERAL I would need to list data from both tables when: The logged in user ID is the same as the IDCONTA field OU When there is a line in the QUIZ table and there is no line in the QUIZ_GERAL...
asked by 10.08.2016 / 22:34
2
answers

LIKE does not work together with BETWEEN

Something wrong with this query? All data is displayed without any filtering. But when I shoot the LIKEs it works or if I take the BETWEEN and leave the LIKEs it works. One only works without the other. Why? $produto =...
asked by 02.08.2016 / 23:11
1
answer

How to create relationship between different data to perform an action?

This statement returns me the state acronym: SC $("#billing\:city").val(dados.uf); I have a select so I can not change: <select id="billing:region_id" name="billing[region_id]"> <option value="">Por favor, selecione o e...
asked by 12.04.2016 / 16:27
4
answers

How to join two rows in SELECT?

I have a problem with joining 2 lines. I researched a lot, but found nothing that could solve my case. In the query below, there are two SELECTs, which return two rows for each extension, as shown below. In the code, I need to merge these two...
asked by 15.04.2016 / 14:18
1
answer

How to return a SQL with result?

I need to select multiple tables bound by the "user id" and return the data to compose a profile page, however some of those tables may be empty at first, ie the query will not find the "id user "in one of them and will return an error or no dat...
asked by 15.07.2016 / 14:06