Skip to content

Tag: mysql

How to correctly convert SQL rows to columns?

Before someone mentions it, I have seen the exact same SQL question on Stack before and from my point of view, that’s actually transposing columns to rows. What I’m trying to accomplish is as seen below in the photos, given the top one, I want to create a new table with the previous data that is f…

Case statment with join-sql

I have a table User which has many messages and many contacts. The relation between messages and contacts table is made trough contactMessages table. Table messages has a foreign key on contactMessages which is the message_id Table contacts has a foreign key on contactMessages which is the contact_id Each mes…

Select from multiple tables with group and join

i have 4 tabels drinks, opskrifter, ingredients and stock the tables consist of drinks drink_id name beskriv glas image alcohol opskrifter drink_id ingredient_id quantity ingredients ingredient_id name stock ingredient_id name i want a query to select drinks that can be made in opskrifter of the ingredients i…

Generate date from sunday except the existing value, in 1 Week Range

This is the result of my query right now with data getting 1 result only. This is my query: $merid=20; I am trying to populate to get the dates the full week beginning Sunday except the existing Tuesday . Can someone give guidelines on where to begin? Is the logical process can be done here in SQL or do I