Questions tagged as 'sql'

2
answers

Update, with select count ACCES

I am trying to update a access table with data from this table. Specifically the account. UPDATE PRODUCTO P, HISTORICO H SET V1= count(menaje) WHERE P.codigo=H.codigo; The thing is, it gives me an error that it does not include V1 as part...
asked by 29.01.2018 / 12:00
3
answers

mysqli and php query does not work

I want to show a certain number of "products" on the screen, I create a series of bootstrap letters to store the information there. I generate my connection (I clarify that the connection is perfect): <?php $conexion = mysqli_connect("lo...
asked by 17.04.2018 / 06:27
1
answer

Error "INCORRECT SYNTAX NEAR '@nombretbl'" trying to query with dynamic table name

Hello Friends, I'm trying to generate several tables in Sql, which will come from a base table. Example: I have a BONUS table that can contain more or less than 4 million records; and I have a CONTEO_CUENTA table, where are the amounts of rec...
asked by 28.12.2017 / 17:32
1
answer

ERROR mysql_num_rows () expects parameter 1 to be resource, boolean given

I have an error in my code: $conexion = connect::con(); $compro_cod = "SELECT * FROM producte WHERE codprod = '$codprod'"; $existe = mysql_query($conexion,$compro_cod); if (mysql_num_rows($existe) > 0){ print_r('Error: Ya existe ese...
asked by 28.12.2017 / 18:17
2
answers

COUNTING ON MYSQL RELATED TABLES

I have two related tables ( Computers and Companies ). Computers (the company column refers to the companies table.) Companies Using MYSQL, I want you to show me the result of how many computers there are in those compan...
asked by 27.11.2017 / 00:00
1
answer

How can I use Postgres INTERVAL with the value of a table column?

INTERVAL is usually used as follows: select now() + interval '1 month' -> intervalo de tiempo What I want is to send you in the time interval, the number of months to add but with the value of the column of a table, for example: tabla....
asked by 23.11.2017 / 17:55
1
answer

Convert query in stored procedure to JSON in POSTGRES

Hello, I am doing a procedure stored in POSTGRES of type GET. I want to consult the information from this one but it sends me the following error: CREATE OR REPLACE FUNCTION p.products(_p_id TEXT) RETURNS TABLE ( _name TEXT , _total MONEY , _p...
asked by 21.11.2017 / 22:57
1
answer

Get MySQL query data to print in HTML

I have a HTML form where I want to show a series of data obtained from a query in MySQL using SQL. Query: static public function obtenerAccesoriosPorCabana($idcabana){ $ejecucion = self::Conexion(); $sql = "SELECT...
asked by 12.12.2017 / 11:16
2
answers

In SQL Server 2008, I need to decrease decimal part

I have the following query: select (select (select(select sum(paquetes) from koc4 where Material = '1000230')*((select AVG (convert(decimal (10,2),(Prom_lote)))as prom_lot from QM where Material = '1000230')/1000) )-((select (select sum(paque...
asked by 21.11.2017 / 13:05
2
answers

Replace a text part in MYSQL table

With which statement you can replace ONLY part of the text in the table. I have a table that has several entries with a text such that: http://miweb.com/textoquequieromantener and I want it to become this: https://miweb.com...
asked by 21.11.2017 / 12:52