Questions tagged as 'mysql'

1
answer

Laravel 5.4 MySQL 5.6.35 - The famous # 1215 - Can not add foreign key constraint

Creating a migration in Laravel 5.4 with MySQL 5.6 I can add an external reference perfectly if it is on the Id of another table, but I can not add it on a string index. This works well on the Id field CREATE TABLE 'stock' ( 'id' int(10...
asked by 04.09.2017 / 19:16
2
answers

Trigger To Update Stock in MYSQL

How about, I'm doing a tool lending system and I need to update the stock of products every time a product comes in or out of the warehouse, I have not used triggers in mySQL and this is being a bit complicated. This is the Trigger that I hav...
asked by 10.10.2017 / 15:39
4
answers

MySQL display records from one table as columns from another

I have a table articulos ------------------------- |id|descripcion|color | |--|-----------|--------| |1 |caja |rojo | |2 |baul |azul | |3 |cofre |amarillo| ------------------------- And another ta...
asked by 11.07.2017 / 18:32
1
answer

Do a MATCH AGAINST query but only the first word?

Good morning. I am working with a php script of a search engine that performs a query to a database mysql using MATCH AGAINST in a column with FULLTEXT INDEX the problem is for example, if in my database I have "Food Mexicana "and in the searc...
asked by 02.10.2017 / 18:28
2
answers

How can I compare range dates correctly php

If I have a date in the database 30-06-2017 and 25-07-2017. public static function getByBETWEEN($fecha1,$fecha2){ $sql = "select * from ".self::$tablename." where date_at > \"$fecha1\" and date_at < \"$fecha2\""; $query =...
asked by 10.06.2017 / 01:35
2
answers

query of any data that is not in the table in mysql

How do I get this out? declare monto double; set monto =500.00; select '','',monto,'','' from [que tabla iría aquí] and the result that is as follows because I want to join a query as a result [vacio] [vacio] [500.00] [vacio] [vacio]...
asked by 13.06.2017 / 21:22
1
answer

Jumps in a field of a table

Good morning, I am new to this site, I would like to know if someone could help me or guide me with this doubt. I have a table in MYSQL call Facturas , have a field called INVOICE NUMBER ( NUMFAC ), among others, the field...
asked by 25.07.2017 / 17:26
3
answers

Improve SQL query to show results

I have two tables which one by means of RIGHT JOIN and the sentence is as follows: $sql= "select * from bookings RIGHT JOIN calendar ON bookings.date=calendar.day_Date GROUP by calendar.day_date"; I add an image with the structure an...
asked by 13.04.2017 / 21:16
2
answers

Bidirectional trigger

I have to make two triggers, one that, after inserting into test1, insert into test2. So far so good, the problem I have is that I should do the same in the inverse case. When there is an insert in test2, I must do the same insert in test1. I un...
asked by 05.06.2017 / 11:32
1
answer

Error with extra attribute when grouping items by categories

I have the following tables: categories |------|--------| | id | name | |------|--------| | 1 | c1 | |------|--------| | 2 | c2 | |------|--------| | 3 | c3 | |------|--------| items...
asked by 06.03.2018 / 01:22