i was wondering if it is possible to make a SELECT query with some optional fields.
i have "Object", "Info", "Image" Tables
the object contains the id and name of objects,
the info contains the additional information of each object and
the Image contains the image of each object.
BUT, not all objects have an image so when i perform this query:
Expand|Select|Wrap|Line Numbers
- SELECT o.name, inf.descritpion, inf.price, img.blob
- FROM object o, info inf, image img
- WHERE o.object_id = "12341234"
- AND inf.object_id = o.object_id
- AND img.object_id = o.object_id
How could i perform this query to get all the results i query excepting those that don't exist?
I am figuring out now a solution to the problem, but it would populate the image table inefficiently:
when someone ads an object, without image, insert a row into images with the object id and with a default value for the image.
This would prevent from returning 0 results, but would also populate the "Image" Table unnecessarily
So if there is a query that allows you to make sort of a try{} please let me know
Thankyou,
bilibytes