We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

SQL query to output entries with no {excerpt}

Development and Programming

James Smith's avatar
James Smith
259 posts
14 years ago
James Smith's avatar James Smith

Hiya,

I’ve been trying and failing to write a query to output all the entry IDs whose search excerpt field is empty. Each channel has a different field set to be the search excerpt.

Any ideas??

       
Ian from Aus's avatar
Ian from Aus
94 posts
14 years ago
Ian from Aus's avatar Ian from Aus

I’m not sure this is possible directly in SQL. If it is possible, it is some nasty SQL.

I’ve gotten around this problem by using 2 SQL queries, one to get the necessary field ID’s, and the second to check those field_id_XX fields for the necessary values.

To do it purely in SQL you would need to be able to do a sub-query which not only built the column names, but also returned only the one column which you want for each row. You would need to pass the channel ID for that row to the sub-query, which I also don’t think you can do.

However, you might be able to achieve it with a MySQL stored function which you pass the channel ID to. I’m still not sure if you can return a value to be used as a column name though.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.