× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello Ashish,

Here is the solution for your sql question : -

SELECT ID, "TYPE", "VALUE" FROM T2
WHERE ID IN (SELECT ID FROM T1) AND
TYPE IN(SELECT TYPE FROM T1) AND
VALUE NOT IN (SELECT VALUE FROM T1)
UNION
SELECT ID, "TYPE", "VALUE" FROM T1
WHERE TYPE NOT IN (SELECT TYPE FROM T2) AND
VALUE NOT IN (SELECT VALUE FROM T2)

This will give you the following output:

OUTPUT
ID TYPE VALUE
schd test xyz
schd test1 abc1

I think this is what you want to achieve correct from T1 & T2 Tables.

Kamal






----- Original Message ----
From: Ashish Kulkarni <kulkarni_ash1312@xxxxxxxxx>
To: java400-l@xxxxxxxxxxxx
Sent: Monday, November 5, 2007 10:34:02 AM
Subject: Suggestion with SQL query


Hi
I need some suggestion with sql query
I have 2 table
T1 which has columns
id, type, value
And
T2 has columns
id, type, value, user

T1 has data as below
id Type value
schd test abc
schd test1 abc1

T2 has data
id Type value user
schd test xyz myid

I want to write a SQL to get data from T1 if there is
no record in T2, The value in T2 may be different from
T1.

So my result after the query will be
(i dont need user id)
id Type value
schd test xyz (this comes from T2)
schd test1 abc1 (this comes from T1)

Any suggestions

Ashish





A$HI$H


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.