Mysql Showing Columns W/ Content

liunx

Guest
Okay I have been stumped on this one for a while. Some of my columns for this one table have content, and some do not. Is there a simple query you can use to tell this? Something where I can enter the constraints I need, and based off the normal result returned for that, show which columns are not set as null?<br /><br />Basically I want something to "select" everything like this:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->SELECT cell_tile FROM cells WHERE cell_x_id >= 0 AND cell_y_id >= 0 AND cell_x_id <= 24 AND cell_y_id <= 24<!--c2--></div><!--ec2--><br /><br />And with that query I want to be able to get which columns from the rows returned had information in them, hopefully the column names being different rows? <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /><br /><br />Thanks!<!--content-->
Well I can certainly help you, but I need to know the names of the structure of your table (column names and what not). <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Thank you for offering but I found out I didn't need to do it that way anyways! But I do have another question... say I have a table with one column and 40 rows with the letter "t" in them. But, I want to set each row to either "t1", "t2", "t3", or "t4" - is there any way to do this with a mysql query? It would be nice if there were a mysql function to generate random integers, but I only see one for decimals. :\ Otherwise I could just use something like UDATE table SET column = concat('t',rand(1,4)).<!--content-->
<!--quoteo(post=152967:date=Oct 22 2005, 03:03 PM:name=D.Slatk)--><div class='quotetop'>QUOTE(D.Slatk @ Oct 22 2005, 03:03 PM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=152967"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->... say I have a table with one column and 40 rows with the letter "t" in them. But, I want to set each row to either "t1", "t2", "t3", or "t4" - is there any way to do this with a mysql query? It would be nice if there were a mysql function to generate random integers, but I only see one for decimals. :\ Otherwise I could just use something like UDATE table SET column = concat('t',rand(1,4)).<!--QuoteEnd--></div><!--QuoteEEnd--><br />There is not a single MySQL function that does what you want, but you can use a combination of functions. Instead of <!--fonto:Courier--><span style="font-family:Courier"><!--/fonto-->concat('t',rand(1,4))<!--fontc--></span><!--/fontc-->, you might try this instead: <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->concat('t', truncate(4*rand()+1,0))<!--c2--></div><!--ec2--><!--content-->
(sorry for the slow reply) Thanks david for that code! It worked excellently!<!--content-->
 
Back
Top