PDA

View Full Version : Mysql Sub Select Problem Pls Help!!!


troublesome
01-16-2005, 08:41 PM
:eek:

right this problem has been getting on my nerves for a while, its my final year project and cant seem to get round the problem. As ive now found out that mysql server does not support sub selects. If it did id code it like this :

$QueryUnSold = "Select Item_Table.Item_Id, Item_Table.Seller_ID, Item_Table.Sale, Item_Table.Category, Item_Table.Sub_Category,
Item_Table.Advert_Title, Item_Table.Price, Item_Table.Sale_Start, Item_Table.Sale_Dur, Item_Table.Sale_End
from Item_Table
WHERE Item_Table.Item_ID != (SELECT Item_Table.Item_ID
FROM Item_Table, Transaction_Table
WHERE Item_Table.Item_ID = Transaction_Table.Item_Id
and Item_Table.Seller_ID = 010581919)";

Subselect getting all id's which are in transaction_table with a particular seller which are also in item_id. i then want to get the oppossite of these id's... that is why i need the sub select but i get the error even when putting it in mysqlfront which is

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT Item_Table.Item_ID FROM Item_Table, Transaction_Table WH

raf
01-17-2005, 08:02 AM
mysql supports subselects from version 4.1. so if you realy need them, then use the current stable version.

else, you need to use an outre join for your find-unmatched query, but this can only be done if Transaction_Table.Item_Id is a Not Null field ...