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 Attermann29 Mar
  • RE: Best Performing Hardware/OS/MySQL?Donny Simonton30 Mar
Re: Best Performing Hardware/OS/MySQL?Ed Reed30 Mar
  • Getting around 2 queriesScott Haneda30 Mar
    • Re: Getting around 2 queriesEgor Egorov30 Mar
    • RE: Getting around 2 queriesMatt Chatterley30 Mar
      • Re: Getting around 2 queriesChuck Gadd31 Mar
Re: Best Performing Hardware/OS/MySQL?Tim Cutts30 Mar
  • Re: Best Performing Hardware/OS/MySQL?Tim Cutts30 Mar
    • Re: Best Performing Hardware/OS/MySQL?Jochem van Dieten30 Mar
Re: Best Performing Hardware/OS/MySQL?Chad Attermann30 Mar