Check availability of appointment slot

I am creating an area for a user where he can make an appointment. The available appointments are inside a table called: bigo_appuntamento This table has these 5 fields bigo_appto_id –> ID …

Larave conditional aggregation to get multiple sum of amount

Hope all is well. Anyone can tell me how can I get to run this SQL query in a the right way in Laravel? Controller: $data=DB::raw(“SELECT name as ‘name’ FROM invoices WHERE country=’$country’…

SQL select multiple arrays and populate one table

I am trying to pupulate 1 table with results from 2 select querys but from the same table. It is not working, one pupulates the other one shows only one result.. Is it posible to do this in one select …

A form can return varying number of values, trying to use the returned values in doctrine query

I have saved a bunch of parsed messages in a db, and I want to be able to pull out results depending on user input. I would like to sort by 1-4 values (more options later on), username, id, email or …

Using ORDER BY and FIELD function to get single value to each custom list

I have a table named orders having 2 columns orderNumber & status as follow : orderNumber | status —————————- 10100 | Shipped | 10101 | Resolved | 10102 …

How to get values from phpmyadmin with the same datetime?

I am building a mini-portal/website and I need to select values with the same DateTime. For example, the first three values have the same DateTime and I would like to select them, yet I don’t know how …

Retrieving all combinations from a database table with alternative values

Say we have a simple DB-table tab created in MySql with CREATE TABLE `tab` ( `id` int(11) NOT NULL AUTO_INCREMENT, `val` int(11) DEFAULT NULL, `altval` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ); …

Inserting data into a table using foreign keys in MySQL

I am trying to insert data into a contacts table using foreign keys in mysql, the structure of tables are as follows CONTACTS TABLE id contactname phone_number fk_id USERS TABLE pers_id …

Add a reference back to original column?

I have a Categories -> Products -> and Review Table. My question is whether it’d be optimal to create a reference from the Review Table and the Category it belongs to, or should I just use the …

Run a database dump (Restore) from an sql file in PHP + PostgreSql

I’m trying to create a system where a user can create a database and have it populated from a UI, pretty much similar to the installation of most CMS’s. I can programatically create the database but …