Skip to content
Advertisement

Tag: database

Seperate tables with same attributes in SQL

When using SQL database, when I have tables with same attributes. For example if I have [posts] with attributes (id, image, description, number of likes and dislikes) [Comments] with attributes (id, image, description, number of likes and dislikes) and [Replies] with attributes (id, image, description, number of likes and dislikes) and I have another type of posts, comments, replies for

Count of line item in MySQL

I have a complex query joined to multiple tables to show a “transaction history”, I want a quick and easy way to count the occurrences of order_id to make it as the line_number. I had it done with code but for performance reason I want to have it done with MySQL. Here is an example of what I have: This

SQL select the latest record on joined tables

I want to retrieve the property which an user paid a tax last. have two tables person_properties and property_taxes What I tried so far: This gives me the person_id along the max year. But I actually need the property_id, the property which an user paid last. If I replace pp.person_id by pp.property_id, I then get all properties, of course.. not

How to make this Query without using UNION?

I am not very good at making query’s. So could someone explain and help me with this query? I need to inner join 2 tables ‘Slaap’ And ‘Eten’. i need all ‘eten’ where ID = 5 and i need all ‘Slaap’ where ID = 5. I could only achieve this with a UNION but that is what i dont want

Advertisement