Jump to content

Need help with mysql query


mabus

Recommended Posts

Hello,

 

I have mysql query problems that I can't seem to figure out yet. the scenario involves two tables, and the objective is to be able come up with an uput that

combines the reults from the two related tables. here's the scenario.

 

ViewType (Id, Name) < --- this is a lookup table

Table B (Id, ProfileId, Date, ViewTypeId) <-- ViewTypeId field is a foreign key associated with ViewTypeTable

 

Now, what I am aimign for is to come up with results that summarizes according the month and the view type.

So the table should have these columsn "Date", "Number of Views", "ViewType 1 view" , "View Type 2 view"

 

Please share your ideas to me.

 

Thanks in advance...

Link to comment
https://forums.phpfreaks.com/topic/129741-need-help-with-mysql-query/
Share on other sites

This one works dude. The "yearmonth" , and "totalviews" columns that it produces are correct , except for the lasts ones. What I'd like to have is to have different columns for the view types too. Got any query suggestions on how I can I achieve that?

 

again, thanks in advance.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.