Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.

Get a Professional Answer

Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.

100% Satisfaction Guarantee

Rate the answer you receive.

Ask Leela-TheProgrammer Your Own Question

Leela-TheProgrammer, Computer Software Engineer

Category: Programming

Satisfied Customers: 474

Experience: Post Grad in CS (Gold Medal)

21067471

Type Your Programming Question Here...

Leela-TheProgrammer is online now

I'm trying to find a way to ensure that my pivot table always

Customer Question

I'm trying to find a way to ensure that my pivot table always has seven columns and 48 rows of data even if the following query doesn't return actual values. I need this so that the daily and interval data is always in the same place. My SQL query is to large to include the entire query. I'd be happy to e-mail it to you. Select DATENAME(DW,tl.DTE) AS DOW, *, case when tl.START_TIME '00:00:00' then 1 else 0 end as 'INT_HR_00:00', case when tl.START_TIME '00:30:00' then 1 else 0 end as 'INT_HR_00:30', case when tl.START_TIME '01:00:00' then 1 else 0 end as 'INT_HR_01:00', case when tl.START_TIME '01:30:00' then 1 else 0 end as 'INT_HR_01:30', case when tl.START_TIME '02:00:00' then 1 else 0 end as 'INT_HR_02:00', case when tl.START_TIME '02:30:00' then 1 else 0 end as 'INT_HR_02:30', case when tl.START_TIME '03:00:00' then 1 else 0 end as 'INT_HR_03:00', case when tl.START_TIME '03:30:00' then 1 else 0 end as 'INT_HR_03:30', case when tl.START_TIME '04:00:00' then 1 else 0 end as 'INT_HR_04:00', case when tl.START_TIME '04:30:00' then 1 else 0 end as 'INT_HR_04:30', case when tl.START_TIME '05:00:00' then 1 else 0 end as 'INT_HR_05:00', case when tl.START_TIME '05:30:00' then 1 else 0 end as 'INT_HR_05:30', case when tl.START_TIME '06:00:00' then 1 else 0 end as 'INT_HR_06:00', case when tl.START_TIME '06:30:00' then 1 else 0 end as 'INT_HR_06:30', case when tl.START_TIME '07:00:00' then 1 else 0 end as 'INT_HR_07:00', case when tl.START_TIME '07:30:00' then 1 else 0 end as 'INT_HR_07:30', case when tl.START_TIME '08:00:00' then 1 else 0 end as 'INT_HR_08:00', case when tl.START_TIME '08:30:00' then 1 else 0 end as 'INT_HR_08:30', case when tl.START_TIME '09:00:00' then 1 else 0 end as 'INT_HR_09:00', case when tl.START_TIME '09:30:00' then 1 else 0 end as 'INT_HR_09:30', case when tl.START_TIME '10:00:00' then 1 else 0 end as 'INT_HR_10:00', case when tl.START_TIME '10:30:00' then 1 else 0 end as 'INT_HR_10:30', case when tl.START_TIME '11:00:00' then 1 else 0 end as 'INT_HR_11:00', case when tl.START_TIME '11:30:00' then 1 else 0 end as 'INT_HR_11:30', case when tl.START_TIME '12:00:00' then 1 else 0 end as 'INT_HR_12:00', case when tl.START_TIME '12:30:00' then 1 else 0 end as 'INT_HR_12:30', case when tl.START_TIME '13:00:00' then 1 else 0 end as 'INT_HR_13:00', case when tl.START_TIME '13:30:00' then 1 else 0 end as 'INT_HR_13:30', case when tl.START_TIME '14:00:00' then 1 else 0 end as 'INT_HR_14:00', case when tl.START_TIME '14:30:00' then 1 else 0 end as 'INT_HR_14:30', case when tl.START_TIME '15:00:00' then 1 else 0 end as 'INT_HR_15:00', case when tl.START_TIME '15:30:00' then 1 else 0 end as 'INT_HR_15:30', case when tl.START_TIME '16:00:00' then 1 else 0 end as 'INT_HR_16:00', case when tl.START_TIME '16:30:00' then 1 else 0 end as 'INT_HR_16:30', case when tl.START_TIME '17:00:00' then 1 else 0 end as 'INT_HR_17:00', case when tl.START_TIME '17:30:00' then 1 else 0 end as 'INT_HR_17:30', case when tl.START_TIME '18:00:00' then 1 else 0 end as 'INT_HR_18:00', case when tl.START_TIME '18:30:00' then 1 else 0 end as 'INT_HR_18:30', case when tl.START_TIME '19:00:00' then 1 else 0 end as 'INT_HR_19:00', case when tl.START_TIME '19:30:00' then 1 else 0 end as 'INT_HR_19:30', case when tl.START_TIME '20:00:00' then 1 else 0 end as 'INT_HR_20:00', case when tl.START_TIME '20:30:00' then 1 else 0 end as 'INT_HR_20:30',

Hi, Thanks for using justanswer. This is Leela and I will help you with the question today.As per my understanding your are trying to find a way to check that a table has specific number of columns and rows in MySql.This can accomplished in multiple ways.1) query meta data of table to find column count, run sql query to count row count. 2) run a select * from table query, check column count and row count from results of the query.Hope this helps.Please let me know if you have any further queries.All the best.Leela