sanjeev kumar

sanjeev kumar

  • NA
  • 15
  • 2.1k

Eliminate duplicate value from table using joins.

Dec 20 2014 6:01 AM
i have a two tables one is hotel and secound is image. 
one is
-------------------------------------------------------- 
USE [bulkmail_test]
GO
/****** Object: Table [dbo].[hg_hotel_master] Script Date: 12/20/2014 16:21:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[hg_hotel_master](
[hotelid] [int] IDENTITY(1,1) NOT NULL,
[added_by] [varchar](50) NULL,
[added_on] [varchar](100) NULL,
[approved] [varchar](5) NULL,
[hotel_name] [varchar](100) NULL,
[star_category] [varchar](50) NULL,
[address_line1] [varchar](100) NULL,
[address_line2] [varchar](100) NULL,
[city] [varchar](50) NULL,
[state] [varchar](50) NULL,
[country] [varchar](50) NULL,
[location] [varchar](50) NULL,
[zone] [varchar](50) NULL,
[nearest_place] [varchar](50) NULL,
[nearest_Dom_airpt] [varchar](50) NULL,
[nearest_Int_airpt] [varchar](50) NULL,
[nearest_bus] [varchar](50) NULL,
[nearest_train] [varchar](50) NULL,
[description] [varchar](7900) NULL,
[remarks] [varchar](7900) NULL,
[view_count] [bigint] NULL,
[is_home] [bit] NULL,
[is_tariff] [bit] NULL,
[google_maps] [varchar](3000) NULL,
[you_tube] [varchar](3000) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[hg_hotel_master] ADD CONSTRAINT [DF_hg_hotel_master_view_count] DEFAULT ((0)) FOR [view_count]
GO
-----------------------------
second one is
USE [bulkmail_test]
GO
/****** Object: Table [dbo].[hg_image_master] Script Date: 12/20/2014 16:22:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[hg_image_master](
[img_seq] [bigint] IDENTITY(1,1) NOT NULL,
[image_type] [varchar](50) NULL,
[mst_id] [varchar](50) NULL,
[image_url] [varchar](50) NULL,
[image_desc] [varchar](1000) NULL,
[added_by] [varchar](50) NULL,
[added_on] [varchar](50) NULL,
[approved] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
when i run the queary
 select * from hg_hotel_master inner join hg_image_master on hg_hotel_master.hotelid=hg_image_master.mst_id where city='435846';
so in this i have diff images with multiple msd id. i want to show single image with single hotel in repater control.plz help me.
 
 
 

Answers (1)