Geeks Talk

Prepare for your Next Interview




SQL query..

This is a discussion on SQL query.. within the SQL forums, part of the Databases category; Hi I have a question regarding to sql query. Can any one do this.? We have two tables tableA and tableB, In tableA there is 20,000 records and in ...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 02-14-2008
Junior Member
 
Join Date: Feb 2008
Location: Mumbai
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
prafulkr is on a distinguished road
SQL query..

Hi
I have a question regarding to sql query. Can any one do this.?

We have two tables tableA and tableB, In tableA there is 20,000 records and in tableB 8000 records present. All records in tableB are duplicate, i have a field "ipd_prod" that is either "bulk" or "prduct name" i want to check only "product name" . Some records of tableB is also present in tableA.

"I want to fetch that records which is not in tableB and `ipd_prod` <> (not ) "bulk" ." ?

what is the sql_query I write for that particular records.


Thanks and Regards
Praful.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-14-2008
Expert Member
 
Join Date: Sep 2007
Posts: 754
Thanks: 22
Thanked 64 Times in 63 Posts
krishnaindia2007 is on a distinguished road
Re: SQL query..

Dear Praful,
Try this query
SELECT fields from tablea
WHERE ipd_prod not in ( select distinct ipd_prod from table b )
AND ipd_prod <> 'bulk'

Regards
Krishna

Last edited by krishnaindia2007 : 02-14-2008 at 05:06 AM.
Reply With Quote
The Following User Says Thank You to krishnaindia2007 For This Useful Post:
  #3 (permalink)  
Old 02-14-2008
Junior Member
 
Join Date: Feb 2008
Location: Mumbai
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
prafulkr is on a distinguished road
Re: SQL query..

SELECT fields from tablea
WHERE ipd_prod not in ( select distinct ipd_prod from table b )
AND ipd_prod <> 'bulk'

this will print all data which is in tableB and not in tableA

I just replace tableA as tableB and tableB as tableA then it will so the data I required.

thanks for your suggetion
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
SQL Query vidyasris SQL 2 09-24-2007 08:24 AM
Query sakshi_2801 SQL 4 08-06-2007 11:29 AM
regarding sql query psuresh1982 SQL 8 07-13-2007 04:20 AM
Query jescalante Oracle 4 06-25-2007 03:13 AM
Query in ASP timmy ASP.NET 1 07-26-2006 04:57 PM


All times are GMT -4. The time now is 06:25 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved