Questions tagged as 'sql'

3
answers

How to sum the count result of different tables in SQL Server?

How to add the count result of different tables in SQL Server? Example: Table WORKS has 755614 Records SELECT count(*) from OBRAS; TITLES table has 85106 Records SELECT count(*) from TITULOS; AUTHORS table has 19029 Records...
asked by 29.12.2017 / 13:29
4
answers

How to execute two querys on a declaration?

I need to mount a MySQL query that returns me the total of rows, and the total of rows with a value greater than 1 in the same query. Total lines : SELECT COUNT(*) FROM tabela Total lines value greater than 1: SELECT COUNT(*) FR...
asked by 26.12.2014 / 20:11
2
answers

Database modeling problem

I have created a system that has sales control ( id , id_vendedor , produto ), vendor ( id , nome , id_equipe ) and team id , nome ) in a company. Example: "João has id: 1 and belongs to the tea...
asked by 15.01.2015 / 03:51
4
answers

SELECT within UPDATE

I have the following database: cd_telefone|cd_cliente |nr_ddd |nr_telefone 1 | 30 | 11 |2562-2791 2 | 30 | 11 |2562-2791 3 | 31 | 13 |8888-8888 4 | 30...
asked by 27.11.2014 / 19:08
2
answers

SQL result has field and index

I have a function in PHP to automate the queries I make: //arquivo funcao.php function executaSql($sql, $param=array()){ try { include "config.php"; $q = $conn->prepare($sql); $q->execute($param); $res...
asked by 28.07.2016 / 15:05
2
answers

Error trying to remove a temporary table [closed]

I have a service where you load data from an ERP into a DW. Because the data source is SQL Server 2008 R2 10.50.1600.1 and the destination server MS SQL Server 2008 10.0.5512.0 SP3. The service executes a stored procedure that generates tem...
asked by 18.01.2016 / 13:26
2
answers

Difficulty checking in MySQL

Firstly I'm starting to mess with mySQL now I'm very lazy on the subject yet I have a table that is named products_search_items and in this table there are 2 columns product_i" and search_item_id I needed to, for examp...
asked by 13.01.2016 / 16:29
3
answers

How to organize the auto-increment numbering of an id column of a table in MySQL?

I would like after each insertion or delete of my table to use a SQL script to rearrange the Ids. Currently it looks something like this: Id Nome 1 João 3 José 5 Ricardo I want to leave it like this: Id Nome 1 João 2 José 3 Ricar...
asked by 18.12.2013 / 18:00
6
answers

Convert varchar to date in SQL

You can convert dates to varchar for date . I'm having difficulty performing cross-date searches because of this discrepancy in the database where I query. When I enter my line of code: select * from TAB_FATURAMENTO where cd_...
asked by 01.06.2017 / 13:55
3
answers

How do I get the current month and year in SQL?

How can I print on the screen the current month and year in sql? I need the month to come out in full. I'm using the query below. select GETDATE() from DUAL It is currently being printed as follows. 2018-08-21 10: 34: 03.253 I need it...
asked by 21.08.2018 / 15:38