Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Statement Help!

Status
Not open for further replies.

johnvai

IS-IT--Management
Oct 4, 2003
127
0
0
LB
Dear friends:

I have the following case that I am requiring the convenient SQL to access the data.(It's been more than 3 days working)
I am using Sybase 5.5.5, I have tried many many SQL statements that sometimes run right, sometimes wrong (which is very weird!).

my sql statement is:
Code:
select ph.tim,u.name,pd.quan,p.descript,p.modifier,pp.portid,ps. printertype,ps.connectedtostation,ps.comport,pd.uniqueid,p.modifier
from products p,station_printer_port sp,product_port pp,printers ps, posdetail pd,posheader ph,userse u 
where ph.transact=pd.transact and ph.userid=u.id and pd.prodnum=p.prodnum and p.prodnum*=pp.prodnum  and pp.portid*=sp.portid and 
sp.printerid=ps.id and ps.connectedtostation=1 and pd.transact=135 order by pd.uniqueid asc

the database schema is found at:

it may happen that some products do not have data in product_port table, which i would like to show their portid as null, even the remaining required fields as null if they don't exist.


Example
the result that I want to see is when the product does not have any entry in the Printer_port table I want the remaining fields to be null as shown in:

Thank you for your help.
P.S. I have posted this question in SQL Jet forum, I think that this is the right forum to ask in.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top