I have a view that works almost perfectly to list what has an item status of FALSE.
----------------------
SELECT node.nid AS nid,
node.title AS node_title,
node.type AS node_type,
node.vid AS node_vid
FROM node node
LEFT JOIN library library ON node.nid = library.nid
WHERE (library.library_status != 0 AND library.in_circulation = 0) AND (node.status <> 0)
ORDER BY node_title ASC
---------------------------
The problem, however, is that if there is more than one item per title, then you are only able to see the status AVAILABLE when clearly one could be checked out. I don't see how it is possible with views but wanted to see if anyone had any suggestions? My MySQL isn't the best (especially where LEFT joins are used), but I was guessing something like the following would be necessary (but I'm obviously wrong because I get an error 1066 in phpMyAdmin "not a uniquetable table/alias library".
-----------
SELECT node.nid AS nid,
node.title AS node_title,
node.type AS node_type,
node.vid AS node_vid
FROM node node
LEFT JOIN library library ON node.nid = library.nid
WHERE (library.library_status != 0 AND library.in_circulation = 0) AND (node.status <> 0)
ORDER BY node_title ASC
-------------------
Any suggestions on the join and is there a way to do this in views or a quick hack to the library module that could be inserted?
Comments
Comment #1
grahlHi daengo
You seem to have pasted the same SQL query twice. Was that intentional? The one presented here runs fine for me in a shell.
Comment #2
abhi_a27 commentedComment #3
daengo commentedI figured out the SQL but now how to make it a view...??
SELECT node.nid AS nid,
node.title AS node_title,
node.type AS node_type,
node.vid AS node_vid,
library.barcode
FROM node
LEFT JOIN library ON node.nid = library.nid
Comment #4
grahl