Questions tagged as 'sql'

1
answer

Proposed Cartesian Product

I need to create a purposive Cartesian product, for a report in Fast reports or multiply my data by a certain number EX: select cli.cdclifor, CLI.nmCliFor from cadclifor cli where cli.cdclifor = '000001' result: 000001 Jõao das Cou...
asked by 12.09.2014 / 22:48
2
answers

SQL Left Join - smaller date greater than current date

3 tables: Processo , Evento , Alerta The goal is to make a query that returns all processes by adding the columns of the event type and date of the most recent event MAX(DataEvento) and the next alert (smaller date g...
asked by 25.05.2018 / 01:50
1
answer

Name of a Role with an accent in the Identity database

The need to create a Role with accent in the Roles table of Identity in the database: "Technical". Myquestioniswhetherthiscanleadtofurtherproblems,perhapswhencheckingforsomethinglikeUser.IsInRole("Técnico") or if the...
asked by 11.05.2018 / 14:57
1
answer

How do I insert a row in the sql table when I click the button?

I have a real estate website that I'm implementing the favorites option. When you open the property and click favorite, it should insert a new row in the favorite table, the one below (status 1 is favorite), and if you "uncheck" it removes the r...
asked by 16.05.2018 / 20:14
4
answers

Day and month comparison in SQL Server

I need to filter all clients that have an anniversary date between two reported dates in a query. How can I make a comparison of dates disregarding the year registered in the client? The current query looks like this: Parameters reported:...
asked by 17.05.2018 / 19:00
1
answer

Query 2 SQL tables bring all results

I am doing a SQL query to bring users, but I consult 2 tables: users and users_vip No users have all users and users_vip only those that are vip (active or not). When I make my query joining the 2 tables it only brings who has a registrati...
asked by 03.05.2018 / 15:04
2
answers

Catch only the year of a column in MySQL

I have a query that has a condition, which checks whether the record is greater than or equal to today's date. It looks like this: WHERE t1.bidpack_buy_date => NOW() Well, it will check if the value of the bidpack_buy_date colu...
asked by 10.04.2018 / 19:17
1
answer

Mount SQL with options

I'm using PostgreSQL on a system of extensions and I have two tables here. One that stores the extensions and the other one that stores the permission to connect these extensions. This second table is structured like this: InthesystemImou...
asked by 05.02.2018 / 19:12
4
answers

SELECT with two results

Table: PEOPLE id - nome 1 - BEATRIZ 2 - MARIA 3 - CARLOS 4 - MARIA 5 - JÉSSICA 6 - HENRIQUE How can I make a SELECT that gives me a list with the names sorted by ID descendente , however, a certain NAME first and below the cont...
asked by 19.01.2018 / 12:24
2
answers

MySQL Query with recursion in N levels

I have the following query select id, nome, user_id from (select * from users order by user_id, id) users, (select @pv := '2') initialisation where find_in_set(user_id, @pv) > 0 and @pv := conc...
asked by 02.03.2018 / 15:04