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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.