DB2 Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDB2 Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old August 15th, 2006, 11:12 AM
varush varush is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2006
Posts: 1 varush User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 11 sec
Reputation Power: 0
Left join problem!

Hi,

I have two tables named SUP, WRK.

I want to join these two tables with few fields

SELECT SUP.*, wrk.*
FROM SUP LEFT JOIN WRK ON SUP.SUPREF = WRK.WRKREF
WHERE 'VARUSH' IN (sup.supanl, sup.supanl2) AND
sup.supsts <> 'X'
ORDER BY SUPANL, SUPDTE.

This statement is working good. I could see all the values from my front end (I am using coldfusion!)

Here is my problem. When I want to add wrk.wrkdte = '08/14/06' like below statement, some of values from wrk is not coming.

SELECT SUP.*, wrk.*
FROM SUP LEFT JOIN WRK ON SUP.SUPREF = WRK.WRKREF AND WRK.WRKDTE = '08/14/06'
WHERE 'VARUSH' IN (sup.supanl, sup.supanl2) AND
sup.supsts <> 'X'
ORDER BY SUPANL, SUPDTE.

This statement also works fine, but some other values of WRK is not coming!

Help would be welcome.

Thanks.

Reply With Quote
  #2  
Old August 16th, 2006, 09:05 PM
ferric84 ferric84 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 38 ferric84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 43 m 36 sec
Reputation Power: 3
Just guessing, but maybe this will return what you're looking for?

SELECT SUP.*, wrk.*
FROM SUP LEFT JOIN WRK ON SUP.SUPREF = WRK.WRKREF
WHERE 'VARUSH' IN (sup.supanl, sup.supanl2) AND
sup.supsts <> 'X' AND WRK.WRKDTE = '08/14/06'
ORDER BY SUPANL, SUPDTE

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDB2 Development > Left join problem!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway