Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago. Improve this question I am looking into building an online card game like that of Hearthstone. Players will have an unlimited inventory to store
Tag: mysql
How to get a COUNT() value when GROUP BY has no row?
RDMS : MariaDB 10.1.23 MCRE : SQLFiddle: http://sqlfiddle.com/#!9/f32a01/1 Consider the following query : Without the GROUP BY clause, I know that COUNT() will return 0 if no row match the query. I also know that, if my GROUP BY “fails” (If i have no row to group by, in my example, if no row satisfy e.created_at > CURRENT_DATE – INTERVAL
Table Join in SQL not returning expected results
My database design is seen as below: I’m interested in finding out what questions are in what questionnaire. So I tried the below in order to output what questions were held inside of the …
Add new column to result and coalesce table
DB Fiddle CREATE TABLE logistics ( id int primary key, campaign VARCHAR(255), event_type VARCHAR (255), date_offered VARCHAR (255), date_ordered DATE, date_delivered DATE, …
How do I update if exist, else insert in MySQL
I have table with AUTO_INCREMENT field defined as PRIMARY_KEY. I have columns like: vote_id,vote_user_id,vote_ask_id,vote_comment_id,vote_post_id,vote_type,vote_status I want to INSERT new records but before I do that I want to check if there is a row with columns(vote_user_id,vote_ask_id,vote_type) as same as the new data I want INSERT. I have searched the internet and learnt about MySQL ..ON DUPLICATE KEY UPDATE. I have
Multi-parameter search with mysql and node.js
Let me preface by saying I’m very new to SQL (and back end design) in general. So for those annoyed with noob questions, please be gentle. BACKGROUND: I’m trying to build a product test database (storing test data for all our products) where I want a user to be able to refine a search to find test data they actually
Mysql Group By age by range [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 help, i need to create report like this the report is group by the age, but i can’t get when age under <=
Displaying Separate Column Values with PHP
I’m currently trying to link up database names with image filenames, and I’ve been successful in doing this so far. However, when I try to put these names on-top of an image, it only takes the last …
sql – how to count rows in sub-query according main query items
I’m trying to get a list like this: StockPart.title | qtyAvailable qtyAvailable is the SUM() of stockItems rows where stock_items.stock_part_id = stock_parts.id (main query) By using something like …
Prioritize one column over another
DB-Fiddle In the table above I have different campaigns with their corresponding quantities. The quantities are filled in different columns. Now, I want to get the latest available quantity for each campaign based on the following hierarchy: The result should look like this: What query do I need to achieve this? Answer Use coalesce():