Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6596933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:08:32+00:00 2026-05-25T18:08:32+00:00

Here’s a piece of the output array(7) { [type]=> string(16) new post comment [book_id]=>

  • 0

Here’s a piece of the output

array(7) { [“type”]=> string(16) “new post comment” [“book_id”]=> string(1) “1” [“name”]=> string(9) “whatever” [“author_id”]=> string(4) “test” [“content”]=> string(19) “2011-07-16 03:20:01” [“create_time”]=> string(1) “3” [“id”]=> string(1) “1” }

And this is part of my query

                     SELECT 'bookcomment' AS type
                                ,b.book_id
                                ,b.name 
                                ,c.book_id 
                                ,c.author_id 
                                ,c.content
                                ,c.create_time AS create_time
                                ,u.id 
                                ,u.name 
                                FROM tbl_book AS b,
                                            tbl_book_comment AS c,
                                            tbl_user AS u
                                WHERE u.id=c.author_id in (1,2) AND b.book_id=c.book_id


                    UNION ALL

                    SELECT 'new post comment' AS type
                            ,po.post_id 
                            ,po.title
                            ,pc.author_id
                            ,pc.content
                            ,pc.create_time AS create_time
                            ,pc.post_id
                            ,u.id
                            ,u.name
                            FROM tbl_post as po,
                                        tbl_post_comment as pc,
                                        tbl_user as u
                            WHERE u.id=pc.author_id in(1,2) AND po.post_id=pc.post_id


                    UNION ALL

                    SELECT 'bookrating' AS type
                                ,b.book_id as one
                                ,b.name
                                ,ra.book_id
                                ,ra.user_id
                                ,ra.rating
                                ,ra.create_time AS create_time
                                ,u.id
                                ,u.name
                                FROM tbl_book AS b,
                                            tbl_user_book_rating AS ra,
                                            tbl_user AS u
                                WHERE u.id=ra.user_id in (1,2) AND b.book_id=ra.book_id


                    UNION ALL...
ORDER BY create_time DESC

As the result shown,data correspond to ‘author_id’ should have correspond to ‘content’ and ‘content’ should be ‘create_time’. What’s wrong with my query?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:08:33+00:00Added an answer on May 25, 2026 at 6:08 pm

    Looks like you’ve mixed up the order of the columns in the second SELECT. Your columns are like this (first query on the left, second in the middle, third on right):

    type            type            type
    b.book_id       po.post_id      one
    b.name          po.title        b.name
    c.book_id       pc.author_id    ra.book_id
    c.author_id     pc.content      ra.user_id
    c.content       create_time     ra.rating
    create_time     pc.post_id      create_time
    u.id            u.id            u.id
    u.name          u.name          u.name
    

    The order gets mixed up at pc.author_id by the look of it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is what I have: Dim cmsManager As New Telerik.Cms.CmsManager() Dim currentNode As Telerik.Cms.Web.CmsSiteMapNode
Here is my problem : I have a post controller with the action create.
Here is my HTML. Just a simple form: <form> Username: <input type=text id=username/> <br/>
Here is my problem. Our tech. writer or customer service will often create new
Here is what I am trying to achieve in PHP: I have this string:
Here's my test function (c#, visual studio 2010): [TestMethod()] public void TestGetRelevantWeeks() { List<sbyte>
Here is a snippet of my xaml: <ComboBox x:Name=cbo1 Width=100 SelectedValue=200> <ComboBoxItem Name=n1>100</ComboBoxItem> <ComboBoxItem
here is the scenario 1: user starts to type some word, autocomplete engine shows
here is my configuration: http://domain.com (obviously fictitious name...) hosted on a server running Apache
Here's a basic regex technique that I've never managed to remember. Let's say I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.