Ohh!! my god .
I haven't seen such kind of query ever before.
Pulling my hairs to minimize it!!!!!!!! [?]
But Can't [?]. I am only able to convert OR in IN clause -
i.e
(GListName = 'Arms' OR GListName = 'Calibre' OR GListName = 'Powder')
to
GListName IN ('Arms','Calibre','Powder')
Actually I am very beginner to solve this. But I would like to know if
anyone can Simplify this.
Best Luck.
Regards,
Shahu.
On Thu, Apr 15, 2010 at 1:36 PM, <[email protected]> wrote:
>
>
>
>
> Server me right for using <pre>
>
> Try again:-
>
>
> SELECT
> a.ClubArmsID, a.ArmsID, a.CalibreID, a.PowderID,
> l1.GListItem AS ArmType, l2.GListOther AS ArmSort,
> l2.GListItem AS ArmCalibre,
> l3.GListItem AS ArmPowder
> FROM steel_arms a
> JOIN
> (SELECT * FROM globallists WHERE GListDeleted = 0
> AND (GListName = 'Arms' OR
> GListName = 'Calibre' OR
> GListName = 'Powder')
> UNION
> SELECT * FROM steel_lists WHERE ListDeleted = 0
> AND (ListName = 'Arms' OR
> ListName = 'Calibre' OR
> ListName = 'Powder')
> ) l1
> ON l1.GListID = a.ArmsID
> JOIN
> (SELECT * FROM globallists WHERE GListDeleted = 0
> AND (GListName = 'Arms' OR
> GListName = 'Calibre' OR
> GListName = 'Powder')
> UNION
> SELECT * FROM steel_lists WHERE ListDeleted = 0
> AND (ListName = 'Arms' OR
> ListName = 'Calibre' OR
> ListName = 'Powder')
> ) l2
> ON l2.GListID = a.CalibreID
> JOIN
> (SELECT * FROM globallists WHERE GListDeleted = 0
> AND (GListName = 'Arms' OR
> GListName = 'Calibre' OR
> GListName = 'Powder')
> UNION
> SELECT * FROM steel_lists WHERE ListDeleted = 0
> AND (ListName = 'Arms' OR
> ListName = 'Calibre' OR
> ListName = 'Powder')
> ) l3
> ON l3.GListID = a.PowderID
> ORDER BY ArmType ASC, ArmSort ASC, ArmCalibre ASC
>
>
>
--
http://phpinterviewanswers.blogspot.com/
[Non-text portions of this message have been removed]
------------------------------------
The php_mysql group is dedicated to learn more about the PHP/MySQL web database
possibilities through group learning. Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php_mysql/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/php_mysql/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/