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...
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...
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...
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...
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...
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...
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...
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_...
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...