Skip to content

Tag: sql

MySQL select based on earlier row’s data (audit table)

I have an audit table that is structured as follows: This table is tracking whether we were able to successfully source a particular data point for a customer. Sometimes we are able to find the data on the first attempt, and you know this because there was no entry with a status of failed, the first occurrenc…

Remove trailing comma

I have a table with names formatted as “Smith, Stan” and need to display them as “Stan Smith”. I was able to do that but it seems that the comma has been left behind and I need to get rid of it. This is what I currently have: Answer How about using replace as below

How to check if a given database exists on the server?

I am doing a union of same table from different databases to get all the company details. Something like below. This is working fine and I am getting all company details, but I want to make sure that database is exist in the server. Because if any one of the union database is not exist in the server then the

All the migrations are working inappropriately

This is the error I get after trying to open the form. Below are the codes. It takes me all day so please kindly help me out. SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘id’ in ‘field list’ (SQL: select max(id) as aggregate from admissions where admissions.deleted_at is nul…