Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. problem with Query

problem with Query

Scheduled Pinned Locked Moved Database
databasehelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mjawadkhatri
    wrote on last edited by
    #1

    Hi.. please solve my prob i try this query select PRODUCTID,u_price, max(qc_dt) dt from qc where PRODUCTID=1011 group by PRODUCTID,u_price order by PRODUCTID result of this query is like productid.,u_price.,dt 1011......6.00.....2010-01-27 00:00:00.000 1011......5.50.....2010-04-27 00:00:00.000 but i want to show the max date record like productid.,u_price.,dt 1011......5.50.....2010-04-27 00:00:00.000 please tell me the query hope you understand i am waiting ur reply.

    P S 2 Replies Last reply
    0
    • M mjawadkhatri

      Hi.. please solve my prob i try this query select PRODUCTID,u_price, max(qc_dt) dt from qc where PRODUCTID=1011 group by PRODUCTID,u_price order by PRODUCTID result of this query is like productid.,u_price.,dt 1011......6.00.....2010-01-27 00:00:00.000 1011......5.50.....2010-04-27 00:00:00.000 but i want to show the max date record like productid.,u_price.,dt 1011......5.50.....2010-04-27 00:00:00.000 please tell me the query hope you understand i am waiting ur reply.

      P Offline
      P Offline
      Paramhans Dubey
      wrote on last edited by
      #2

      Try this select top 1 PRODUCTID,u_price, max(qc_dt) dt from qc where PRODUCTID=1011 group by PRODUCTID,u_price order by qc_dt

      M 2 Replies Last reply
      0
      • P Paramhans Dubey

        Try this select top 1 PRODUCTID,u_price, max(qc_dt) dt from qc where PRODUCTID=1011 group by PRODUCTID,u_price order by qc_dt

        M Offline
        M Offline
        mjawadkhatri
        wrote on last edited by
        #3

        thanks this query is working for me :)

        1 Reply Last reply
        0
        • P Paramhans Dubey

          Try this select top 1 PRODUCTID,u_price, max(qc_dt) dt from qc where PRODUCTID=1011 group by PRODUCTID,u_price order by qc_dt

          M Offline
          M Offline
          mjawadkhatri
          wrote on last edited by
          #4

          :( when i change the productid query show old record but i want to show latest u_price of product.

          1 Reply Last reply
          0
          • M mjawadkhatri

            Hi.. please solve my prob i try this query select PRODUCTID,u_price, max(qc_dt) dt from qc where PRODUCTID=1011 group by PRODUCTID,u_price order by PRODUCTID result of this query is like productid.,u_price.,dt 1011......6.00.....2010-01-27 00:00:00.000 1011......5.50.....2010-04-27 00:00:00.000 but i want to show the max date record like productid.,u_price.,dt 1011......5.50.....2010-04-27 00:00:00.000 please tell me the query hope you understand i am waiting ur reply.

            S Offline
            S Offline
            Simon_Whale
            wrote on last edited by
            #5

            try

            select top 1 productid, u_price, qc_dt
            from (select productid, u_price, qc_dt
            from qc
            where productid = 1011
            order by qc_dt desc) z

            Marc Clifton wrote:

            That has nothing to do with VB. - Oh crap. I just defended VB!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups