ismael_lopez Posted May 6, 2011 Share Posted May 6, 2011 Hello im trying to achieve something really fancy with my database like explained before, but i really suck with sql and i need some help please, by the way its in mysql but no one in that forum could help me so i posted here table a column common column date column name column lastname table b column common column date column animal column plant column toy table c column common column date column electronic table d column common column date column vehicle Lets say i want it to display each name and lastname of every person and display the sum of each animal, plant, toy, electronic and vehicle that each person have at a given date, even if one of them doesnt have a toy. For example name lastname animal plant toy electronic vehicle peter griffin 2 0 4 5 1 Quote Link to comment https://forums.phpfreaks.com/topic/235738-query-help/ Share on other sites More sharing options...
mikosiko Posted May 7, 2011 Share Posted May 7, 2011 you must show what have you tried already.... if you don't know where to start here is a couple hints: JOIN SUM put some effort studying the examples, write some code, and come here with specific questions/doubts and sure someone will help. Quote Link to comment https://forums.phpfreaks.com/topic/235738-query-help/#findComment-1211748 Share on other sites More sharing options...
trq Posted May 7, 2011 Share Posted May 7, 2011 Your database design is the problem. Why do you have multiple tables containing the same types of data? Quote Link to comment https://forums.phpfreaks.com/topic/235738-query-help/#findComment-1211844 Share on other sites More sharing options...
ismael_lopez Posted May 9, 2011 Author Share Posted May 9, 2011 Well the columns are no really named like that its just an example with the same structure, but i mean I have tried like everything and could not do it Quote Link to comment https://forums.phpfreaks.com/topic/235738-query-help/#findComment-1212856 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.