| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Chuck Gadd | Date: | March 30 2004 11:35pm |
| Subject: | Re: Getting around 2 queries | ||
| View as plain text | |||
Matt Chatterley wrote: > One option would be to 'union' the two queries (assuming the columns are the > same type and length), allowing you to run one query string: > > Select serial from blacklist where serial = x > Union > Select serial from seriallist where serial = x > > Would return 1 or 2 rows, depending on whether rows are found in one table > or both. You wouldn't know which table though (but from your message, I > guess that is unimportant). If you needed to know which table it came from, you could just expand this query a little: Select serial,'blacklist ' as Tablename from blacklist where serial = x Union Select serial,'seriallist' as Tablename from seriallist where serial = x
| Thread | ||
|---|---|---|
| • Best Performing Hardware/OS/MySQL? | Chad Attermann | 29 Mar |
| • RE: Best Performing Hardware/OS/MySQL? | Donny Simonton | 30 Mar |
| • Re: Best Performing Hardware/OS/MySQL? | Ed Reed | 30 Mar |
| • Getting around 2 queries | Scott Haneda | 30 Mar |
| • Re: Getting around 2 queries | Egor Egorov | 30 Mar |
| • RE: Getting around 2 queries | Matt Chatterley | 30 Mar |
| • Re: Getting around 2 queries | Chuck Gadd | 31 Mar |
| • Re: Best Performing Hardware/OS/MySQL? | Tim Cutts | 30 Mar |
| • Re: Best Performing Hardware/OS/MySQL? | Tim Cutts | 30 Mar |
| • Re: Best Performing Hardware/OS/MySQL? | Jochem van Dieten | 30 Mar |
| • Re: Best Performing Hardware/OS/MySQL? | Chad Attermann | 30 Mar |
