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. Query (find max from two table resultant row should be single in sql 2005)

Query (find max from two table resultant row should be single in sql 2005)

Scheduled Pinned Locked Moved Database
database
3 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.
  • A Offline
    A Offline
    azad yadav
    wrote on last edited by
    #1

    Dear friend I want to write a query that produced single row find the max form two table and also query that delete all redundant data from table in sql 2005 Thanks and regards Azad Yadav

    R A 2 Replies Last reply
    0
    • A azad yadav

      Dear friend I want to write a query that produced single row find the max form two table and also query that delete all redundant data from table in sql 2005 Thanks and regards Azad Yadav

      R Offline
      R Offline
      Reza Raad
      wrote on last edited by
      #2

      azad yadav wrote:

      write a query that produced single row find the max form two table

      you can get max for each table and then find max from two result . same as this code:

      select max(twotable.fieldmatch) from
      (
      select max(field1) as fieldmatch from table1
      UNION
      select max(field1) as fieldmatch from table2
      )twotable

      azad yadav wrote:

      query that delete all redundant data from table in sql 2005

      This is a general question , you must specify what you mean exactly.

      Human knowledge belongs to the world http://www.rad.pasfu.com/index.php

      1 Reply Last reply
      0
      • A azad yadav

        Dear friend I want to write a query that produced single row find the max form two table and also query that delete all redundant data from table in sql 2005 Thanks and regards Azad Yadav

        A Offline
        A Offline
        anup keshari
        wrote on last edited by
        #3

        one thing between two table should have delete cascading on master table . then u can use delete from mastertable where id = select top 1 id from (select max(id) as id from master a join detail b on a.id=b.id )as a

        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