You could create a table that is the combination of manufacturer and
products table, with identical column and key information as the custom
table -- call this say manprod table, then create a merge table from the
manprod and custom table, and run one select query against the newly created
merge table:

http://www.mysql.com/doc/M/E/MERGE.html

Regards,
Dan
> -----Original Message-----
> From: Nathan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 27 February 2002 12:33 p.m.
> To: MySQL
> Subject: Combining two similar queries?
>
>
> Good afternoon, list!
>
> I am attempting to figure out how to get the following two
> queries smashed into one. Both of these
> work very well on their own. I am not sure if this is possible,
> but it seems like it should be :-)
>
> =-=-=-=-=
> QUERY  #1
> =-=-=-=-=
>
> SELECT
>  mt.manufacturer,
>  pt.model,
>  rt.qty,
>  rt.item_order,
>  rt.description,
>  rt.status,
>  rt.version,
>  if(rt.status = 'del', 0, (rt.qty * rt.this_sell)) AS sell_ttl
> FROM
>  room_table rt,
>  products pt,
>  manu mt
> WHERE pt.product_id = rt.product_id
>   AND pt.manu_id = mt.manu_id
>   AND rt.room_id = 2
>   AND rt.print = 'Yes'
>   AND rt.type = 'product'
> ORDER BY rt.item_order, mt.manufacturer, pt.model;
>
> =-=-=-=-=
> QUERY  #2
> =-=-=-=-=
>
> SELECT
>  ct.manufacturer,
>  ct.model,
>  rt.qty,
>  rt.item_order,
>  rt.description,
>  rt.status,
>  rt.version,
>  if(rt.status = 'del', 0, (rt.qty * rt.this_sell)) AS sell_ttl
> FROM
>  room_table rt,
>  custom ct
> WHERE ct.product_id = rt.product_id
>   AND rt.room_id = 2
>   AND rt.print = 'Yes'
>   AND rt.type = 'custom'
> ORDER BY rt.item_order, ct.manufacturer, ct.model;
>
> Both return the same number of columns with the same information
> type in each column, but I can't
> figure out how to get both integrated into one query. I have been
> staring at the manual long enough
> to make me think either this isn't possible (unlikely) or that
> I'm just trying to over-complicate
> the hell out of it (much more likely) and I'm missing some basic concept.
>
> I have tried a few things and it's beyond me at the moment... any
> insights would be greatly
> appreciated!!! Further info is definitely available if needed.
>
> Thanks!
>
> # Nathan
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to