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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL-Query too long?

Status
Not open for further replies.

marinelli82

Programmer
Apr 22, 2005
5
DE
Hello,

I am quite new at MySQL, and that forum =)
My question is how long SQL-queries may be.. because I have several tables in my database and have to link some of them to get my wished data..
Now I could send my request by one SQL statement:

SELECT ma.benutzername, at.abteilung, sd.datum, sd.projekt_nr, kd.kunde, kd.kunden_nr, lf.lieferant, lf.lieferanten_nr, sd.bestell_nr, sd.lieferschein_nr, sd.intern, pz.prozess
FROM stammdaten AS sd,
mitarbeiter AS ma,
abteilungen AS at,
kunden AS kd,
lieferanten AS lf,
prozesse AS pz
WHERE datensatzID = 2
AND erstellerID = mitarbeiterID
AND ma.abteilungsID = at.abteilungsID
AND sd.kundenID = kd.kundenID
AND sd.lieferantID = lf.lieferantID
AND sd.prozessID = pz.prozessID


or split it in several requests..
Which method will be faster?
Or shall I restructure my tables anyway if I need such complex requests to get my wished data?

thanks a lot

bye

Andy
 
I've written queries 10 times longer than that.

I would write the query that makes sense and if the performance is bad, look at tuning the query and indexing your data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top