Mike Yenco <m...@yenco.com> wrote:
> I have a SQLite database that has two tables...  one named
> "Transactions" and another named "Items".  They both share in common a
> column named "ItemizeID".
>
> I currently have a SELECT that is set up like this:
>
> SELECT isSelected,TransactionID,Date,Description,Total FROM
> Transactions WHERE AccountID = "[[accountID]]" AND (Label LIKE "%
> [[searchstring]]%" OR Description LIKE "%[[searchstring]]%" OR Notes
> LIKE "%[[searchstring]]%") ORDER BY ROWID DESC,Date DESC;
>
> All of the above is ONLY dealing with the "Transactions" table.
>
> But I also want to have the data from "Transactions" returned (JOIN
> via the "ItemizeID"?) where Items.Description LIKE
> "%[[searchstring]]%";
>
> I'm a bit concerned because there could be several matching "items"
> with the same "ItemizeID", but I only need to return the data from
> "Transactions" once for each unique ItemizeID encountered as part of
> the search.
>
> I'm not entirely sure how to do this with SQLite syntax.

and ItemizeID in (
    select ItemizeID from Items where Description LIKE 
%[[searchstring]]%
)

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to