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 6627123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:58:33+00:00 2026-05-25T21:58:33+00:00

This is the code: Select BCPP.* from ViewPBCPP BCPP inner join ( Select MBC.PC

  • 0

This is the code:

Select BCPP.*
from ViewPBCPP   BCPP
inner join
( 
Select MBC.PC     PC
      ,MRT.Name   CT
      ,Max(dbo.CalcDatefromUTC(MBC.CreatedDate)) as LRDate
from TableBACC    MBC

inner join TableSC.RT   MRT
ON MBC.RTid = MRT.id
where MBC.Isdeleted = 'False'
and MBC.PC <> 'NULL'
Group by MBC.PC
        ,MRT.Name
) MBCR
ON BCPP.P_id = MBCR.PC
and BCPP.CreatedDate = MBCR.LRDate
and BCPP.CT = MBCR.CT

Now Max(dbo.CalcDatefromUTC(MBC.CreatedDate)) is actually a function

Query above works fine with Max(dbo.CalcDatefromUTC(MBC.CreatedDate))

Now when I write

Max(dbo.CalcDatefromUTC(MBC.CreatedDate)) + Min(dbo.CalcDatefromUTC(MBC.CreatedDate))

I cannot extract any values at all from this query written above

If I write just

(dbo.CalcDatefromUTC(MBC.CreatedDate))

it gives me error that it does not contained aggregate function or the group by function

I actually want this

(dbo.CalcDatefromUTC(MBC.CreatedDate))

so that I can use all the values of this function rather than just MAX values of it

How can I change this code written above to achieve my objective??

Anyone??

  • 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-25T21:58:34+00:00Added an answer on May 25, 2026 at 9:58 pm

    You can’t have dbo.CalcDatefromUTC(MBC.CreatedDate) in the SELECT list as neither you can have MBC.CreatedDate because it’s not in the GROUP BY list.

    You can have MAX(MBC.CreatedDate) though because it uses an aggregate function (MAX) on thta column. You can also have:

    dbo.CalcDatefromUTC(MAX(MBC.CreatedDate)) as LRDate
    

    which is the same actually (although maybe a bit faster), as:

    MAX(dbo.CalcDatefromUTC(MBC.CreatedDate)) as LRDate
    

    From your comments, I assume the above is not very helpful. Perhaps grouping by MBC.CreatedDate as well is what you want:

    Select BCPP.*
    from ViewPBCPP   BCPP
    inner join
    ( 
    Select MBC.PC     PC
          ,MRT.Name   CT
          ,dbo.CalcDatefromUTC(MBC.CreatedDate) as LRDate
    from TableBACC    MBC
    
    inner join TableSC.RT   MRT
    ON MBC.RTid = MRT.id
    where MBC.Isdeleted = 'False'
    and MBC.PC <> 'NULL'
    Group by MBC.PC
            ,MBC.CreatedDate                  --- added
            ,MRT.Name
    ) MBCR
    ON BCPP.P_id = MBCR.PC
    and BCPP.CreatedDate = MBCR.LRDate
    and BCPP.CT = MBCR.CT
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i develop this code: SELECT COUNT(NewEmployee.EmployeeID), NewEmployee.EmployeeId,EmployeeName FROM NewEmployee INNER JOIN NewTimeAttendance ON NewEmployee.EmployeeID
i have this code SELECT DISTINCT idx_campus_bookinfo,c.userid as Buyer,bookname,book_explain,writedate FROM campus_bookinfo cb LEFT JOIN
I'm using a prepared statement with this SQL code: SELECT `name` FROM `securities` WHERE
So I have this code in a google app engine template: <select name='voter'> {%
What does STRAIGHT_JOIN do in this code ? SELECT STRAIGHT_JOIN ClosingBalance FROM Accounts WHERE
this is my code for now: SELECT id, number FROM Media WHERE user =
is this good code? can it be simplified somehow? SELECT u.id,u.title,u.title,u.first,u.last FROM (((tblusers u
I have this partial code: if ($getRecords = $con->prepare(SELECT * FROM AUCTIONS WHERE ARTICLE_NO
I have this php code $jsonArray = array(); $sql = SELECT ID,CLIENT FROM PLD_SERVERS;
This is my code: $query = mysql_query(SELECT * FROM books ORDER BY id) or

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.