Commit 38a2782a authored by Colin Chung's avatar Colin Chung
Browse files

fix git

parent 81d0af6f
......@@ -453,20 +453,11 @@ def search():
<<<<<<< Updated upstream
sql_command = "WITH recipeIds AS (select distinct recipe_id from recipe_tag inner join tag using (tag_id) WHERE name IN " + tag_list_string + "),"\
"tag_join as (select recipe_id, tag.name as 'tag_name' from recipes inner join recipe_tag using (recipe_id) inner join tag using(tag_id) inner join recipeIds using (recipe_id)), "\
"ingredient_join as (select recipe_id, ingredients.name as 'ingredient_name' from recipes inner join recipe_ingredients using (recipe_id) inner join ingredients using(ingredient_id) inner join recipeIds using (recipe_id))"\
"select recipes.*, group_concat(distinct ingredient_name separator ', '), group_concat(distinct tag_name separator ', ') from recipes inner join tag_join using(recipe_id) inner join ingredient_join using (recipe_id) group by recipe_id;"
=======
sql_command = "WITH tagIds AS (SELECT tag_id FROM tag WHERE name IN " + tag_list_string + ") SELECT recipes.* FROM recipes INNER JOIN recipe_tag USING(recipe_id) INNER JOIN tagIds USING(tag_id);"
#print(sql_command)
>>>>>>> Stashed changes
sql_command = "WITH tagIds AS (SELECT tag_id FROM tag WHERE name IN " + tag_list_string + "), tag_join as (select recipe_id, tag.name as 'tag_name' from recipes inner join recipe_tag using (recipe_id) inner join tag using(tag_id) inner join tagIds using (tag_id)),"\
"ingredient_join as (select recipe_id, ingredients.name as 'ingredient_name' from recipes inner join recipe_ingredients using (recipe_id) inner join ingredients using(ingredient_id) inner join recipe_tag using (recipe_id) inner join tagIds using (tag_id))"\
"select recipes.*, group_concat(distinct ingredient_name separator ', '), group_concat(distinct tag_name separator ', ') from recipes inner join tag_join using(recipe_id) inner join ingredient_join using (recipe_id) group by recipe_id;"
cursor.execute(sql_command)
tables = cursor.fetchall()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment