PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: m-grady at uiuc dot edu
Subject: avoiding the cross-product
Date: Feb 22 2000 7:02AM

This is more of a basic sql question (I'm pretty new to sql). I need
to do a 'dump' of a Sybase database for initializing an LDAP database.
A person record in the Sybase database spans a number of tables, where
some of the info is singly-occurring, and other is multiply occurring
(e.g. the appointment table can have n rows for the same employee, and
the 'general attribute' table can have m rows for that person.) If I do
a massive join to get all that info, I get n*m rows for that person in
the result set.

Now since this dump might only happen once, a certain amount of
inefficiency can be tolerated. But not n*m rows per person. So what is
the right way to do this? Do I just get the singly occurring stuff in
one query, and then get each of the multiply-occurring stuff in
separate queries each? Or is there a different technique that accomplishes
this?

--
Michael A. Grady                            m-grady@uiuc.edu
Senior Research Programmer                  http://ljordal.cso.uiuc.edu 
University of Illinois                      (217) 244-1253  phone
Computing & Communications Services Office  (217) 244-7089  fax
Rm. 1514 DCL, 1304 W. Springfield Ave       Urbana, IL 61801