sql query



IBM's flagship relational database management system

sql query

Postby surime72 » Mon Jun 04, 2012 7:53 pm

hi guys,
SELECT A.col1, A.col2, A.col3,
A.col4, A.col5, A.col6, A.col7
FROM table A, table B
WHERE A.col1 <> B.col1(of table B),
while i was running this query fetching huge data
surime72
 
Posts: 107
Joined: Sun Oct 23, 2011 1:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: sql query

 

Re: sql query

Postby surime72 » Mon Jun 04, 2012 7:56 pm

from the above query i need data from only one table ie:table1
surime72
 
Posts: 107
Joined: Sun Oct 23, 2011 1:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: sql query

Postby Akatsukami » Mon Jun 04, 2012 8:20 pm

surime72 wrote:hi guys,
SELECT A.col1, A.col2, A.col3,
A.col4, A.col5, A.col6, A.col7
FROM table A, table B
WHERE A.col1 <> B.col1(of table B),
while i was running this query fetching huge data

And your point is...?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1054
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: sql query

Postby dick scherrer » Tue Jun 05, 2012 8:11 am

Hello,

You will get more useul replies if you explain what you "have" and what you "want".

Show some sample table input (relevant columns only) and the result you want from your query when processed.

If you are unwilling to post some sample data and the output requirement, the most i can offer is to write a query that refers to only 1 table and has a rather restrictive WHERE. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: sql query

Postby surime72 » Tue Jun 05, 2012 12:19 pm

the query displaying huge data with repeted data from tables
surime72
 
Posts: 107
Joined: Sun Oct 23, 2011 1:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: sql query

Postby surime72 » Tue Jun 05, 2012 12:31 pm

hi can please tel
select DISTINCT T1.NO FROM TABLE1 T1
LEFT JOIN TABLE2 T2 USING (NO) WHERE T2.NO IS NULL canany tel what is wrong from above query

i need to fetch non joining of table t1
surime72
 
Posts: 107
Joined: Sun Oct 23, 2011 1:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: sql query

Postby GuyC » Tue Jun 05, 2012 1:37 pm

A course in SQL would be useful :
SELECT A.col1, A.col2, A.col3,
A.col4, A.col5, A.col6, A.col7
FROM tableA A
WHERE not exists (select * from tableB B where  B.col1 = A.col1)
I can explain it to you, but i can not understand it for you.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

Re: sql query

Postby surime72 » Tue Jun 05, 2012 3:05 pm

hi guyc
i was tried the query it also fetching huge data from table.....
thank u....
surime72
 
Posts: 107
Joined: Sun Oct 23, 2011 1:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: sql query

Postby GuyC » Tue Jun 05, 2012 3:39 pm

maybe tell us
- how the tables look like
- how they are related
- exacactly what you want
and then maybe we could help you.
or give some example rows of A and B and what you expect as the output : which rows you want to see, which rows you don't want to see.
I can explain it to you, but i can not understand it for you.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

Re: sql query

Postby surime72 » Tue Jun 05, 2012 4:11 pm

SELECT A.I_PART, A.I_RCPT_CHNG_LVL, A.I_PO,
A.X_RCPT_COMNT, A.I_MATL_DOCU, A.Q_GOODS_RECVD, A.D_GOODS_RECVD
FROM EPPS.EOGPREC A WHERE NOT EXISTS (SELECT * FROM PRDT.TBPART04 B
WHERE A.I_PART = B.PART_NO

i need non matching rows of table eogprec
iwas trying to fetch these values to ispf screens
it showing error as ISPP113 Unable to get save area - Additional storage needed is unavailable
for display processing
surime72
 
Posts: 107
Joined: Sun Oct 23, 2011 1:45 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to DB2

 


  • Related topics
    Replies
    Views
    Last post