-1
How to unite these 2 selects
?
MY TABLES
EVENT TITLE DESCRIPTION CATEGORY_ID
CATEGORY NAME COLOR ICON DESCRIPTION
this select below works perfectly does the right Count I need to do the same without Count in the other two selects
SELECT category.*,(SELECT COUNT(*) FROM event
WHERE category_id = category.id)as total FROM category
I’ve tried it this way
"SELECT category.* FROM event WHERE category_id = 4)
FROM category ORDER BY MONTH(date_at)DESC "
In the other Table
SELECT * FROM event WHERE DATE(date_at) = CURDATE()
"SELECT category.* FROM event WHERE category_id = 5)
FROM category ORDER DATE(date_at) = CURDATE() "
I got it this way
SELECT *, color
FROM event , category
WHERE event.id = event.category_id ;
soh could not put the WHERE DATE(date_at) = KURDATE()
Someone ?
You will need to name the columns if they are not equal.
– Jéf Bueno
They have the same fields with the same types, could make available the layout and which fields will compose the two SQL?
– novic
What result do you expect for this query? The number of events for a specific category along with the category information?
– Jonathan Lamim Antunes
@carloscoelho has to put the two tables in your question and indicate your comment also in the question?
– novic
No need to put it in capital letters, it seems to be screaming !
– novic