I have 4 tables that I want to run a single query on. I want specific values from each table that all relate to a single user. However, some of these tables may not have any associated records. If there are no records in a given table, the query set comes back as empty (because there are no records pertaining
Tag: mysql
Create category column mysql
I have a transactions table, I want to query it using MySQL 5.7 group by vendor and count number of transaction, and categorize vendor by these criteria Great: More than 2 SHIPPED and 0 CANCELLED transactions OK: More than 2 SHIPPED and 1 or more CANCELLED transactions Mediocre: other than Superb and Good cri…
mariadb/mysql Nested `WITH` statement causes table-not-found error
I am not sure if this is a documented limit in mariadb or a bug in its query parsing. We are porting some enormous queries from vertica to mariadb, and I have encountered cases where queries with …
How to mix left and right joins with cross reference table
I’m using Mysql. I have table A(ida) and table B(idb) and a cross reference table CR(ida, idb). I want to capture in a query the relationship between A and B (basically what’s is CR) but I also want all the rows from A and B that have no relations present in CR. To get something like this: I tried…
sql query to replace backslashes ‘\’ with ‘/’
I know very little about sql queries but I need a query to replace ‘\’ with ‘/’ I have a WordPress database where there are characters in a long text string that look like this in phpMyAdmin Browse. ‘\uploads\photos\’ It needs to be ‘/uploads/photos/’. I want a …
Creating query for printing average of two months [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I need to show monthly average of total using SQL and PHP. For example this table has total=…
Searching a formatted address in SQL table where columns are split
How would I go about searching (and possibly full-text index searching) on a table for address data that is structured as per below: When searching for an address I’d like to search for the whole address. Ideally I’d like to be able to search the table like this: Thanks for your help in advance An…
SQL Join – Limit to base table
I have 4 tables that I want to link together based on the information in the sales_details table which will serve as the base table (limiting results based on the sales_details table) 1)I want to pull all columns from the sales_detail table that are mastercard orders but since the sales_detail table doesnR…
sequelize updating multiple rows
Update multiple rows , is using a bulk update a good solution or something like the code below works ? . I supposed wanted to update all the records with the id and filename. I did try to update …
Depending on column value, query different tables
I have table A where each IDENTIFIER value is unique. Depending on whether its CC or DC, I need to join it with different tables, for example if its “CC_” I need to map it to table B and if its “DC_” I need to map it to table C. TABLE A: TABLE B: TABLE C: I want the result