Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you're able to, a redesign of the tables would really help. Depending on how many properties there are, and reasons for partitioning the days into different tables, you could have a single table called DayData which has columns Date (maybe stored as an int or using SQL 2008 R2's DATE data type) Field Value</p> <p>If position matters (eg author1 is somehow treated differently from author2) then you could also have an index field (type integer). It depends on whether you always have exactly 5 values of each type, or if you may have 0, 1 or N, and whether or not the types can change over time.</p> <p>Anyway, if you're stuck with what you've got, you could try full text search, or if that's a bridge too far, try</p> <pre><code>"SELECT * from (select * from D1Table UNION D2Table) D1D2 WHERE Synopsis LIKE '%" + txtBText + "%' OR Author1 LIKE '%" + txtBText + "%' OR Author2 LIKE '%" + txtBText + "%' OR Author3 LIKE '%" + txtBText + "%' OR Author4 LIKE '%" + txtBText + "%' OR Author5 LIKE '%" + txtBText + "%' OR Biography1 LIKE '%" + txtBText + "%' OR Biography2 LIKE '%" + txtBText + "%' OR Biography3 LIKE '%" + txtBText + "%' OR Biography4 LIKE '%" + txtBText + "%' OR Biography5 LIKE '%" + txtBText + "%' OR Title LIKE '%" + txtBText + "%' OR Position1 LIKE '%" + txtBText + "%'OR Position2 LIKE '%" + txtBText + "%' OR Position3 LIKE '%" + txtBText + "%' OR Position4 LIKE '%" + txtBText + "%' OR Position5 LIKE '%" + txtBText + "%' "; </code></pre> <p>Note the derived table called D1D2: (select * from D1Table UNION D2Table)</p> <p>However, you have another problem - building the statement like you are is vulnerable to a SQL injection attack (search this site or Google). Someone could put </p> <pre><code>'--delete * from D1Table; 'select * from D1Table where ''1= </code></pre> <p>and delete the data from your D1Table. Major websites get hacked using similar techniques - rather than deleting data the queries are manipulated to generate error messages or deliberate timing delays, leaking information about the database design and usernames, passwords, etc.</p> <p>Hope that helps :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload