#mysql - Thu 15 Mar 2007 between 00:00 and 00:06



chadmaynardso the two tables are unrelated?
RadarListenerThe only thing linking them is the customer_id.
Yes, unrelated.
chadmaynardso no joins, etc.
vlutherbut they have customer_id in common ?
RadarListenerYes.
No joins, nothing.
dennister(yes, i'm a newb, but got mythtv with ivtv card going in 3-4 months)
RadarListenerUsually I'd query the two tables seperately, but this would be much easier if it was just one query.
chadmaynardthey should be two queries.
if they are unrelated
sid: I dunno what you're doing?
RadarListenerI dont want to have to write all that PHP code again just for another table.
I would like all the information IN ONE QUERY.
chadmaynardwhoa dude. Don't type in caps
RadarListenerI know if I do SELECT * FROM `jobs`,`warranties` it gives me everything from both tables.
vlutherso wait.. you're getting mad at us because we aren't helping properly ?
RadarListenervluther, if that's how you choose to interpret it, so be it.
So how do I select everything from both tables where the customer_id is the same?
chadmaynardRadarListener: you are asking for a quick trip out of here
zircuRadarListener: does a job have a warranty or vise versa?
RadarListenerzircu, no.
chadmaynardRadarListener: do they have the same number of cols?
vlutherselect jobs.field1,jobs.field2,warranty.field2,warranty.field3 from jobs, warranties WHERE jobs.customer_id=warranty.customer_id AND jobs.customer_id=X
RadarListenerchadmaynard, yes.
sidthanks chadmaynard, I appreciate the help.
RadarListenerThey are identical.
chadmaynardUNION
SELECT * FROM t1 UNION SELECT * FROM t2;
zircuRadarListener: so why the need to be done in one query?
RadarListenerzircu, I have a whole block of PHP code that I dont want to repeat.
chadmaynardcause he WANTS IT THAT WAY!
RadarListenerAbout 70 lines.
chadmaynarddid you try the union?
RadarListenerWhere does the where statement go? After it?
zircuRadarListener: that doesn't make sense
chadmaynardzircu: i agree
RadarListenerzircu, which part?
zircuRadarListener: what you want is one line of sql so you dont have to do something again?
chadmaynardRadarListener: yes

Page: 2 9 16 23 30 37 44 51 58 65 72 79 

IrcArchive