D.Slatk Posted October 9, 2005 Share Posted October 9, 2005 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? Basically I want something to "select" everything like this: >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 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? Thanks! Quote Link to comment Share on other sites More sharing options...
Charlie Posted October 17, 2005 Share Posted October 17, 2005 Well I can certainly help you, but I need to know the names of the structure of your table (column names and what not). Quote Link to comment Share on other sites More sharing options...
D.Slatk Posted October 22, 2005 Author Share Posted October 22, 2005 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)). Quote Link to comment Share on other sites More sharing options...
TweezerMan Posted October 22, 2005 Share Posted October 22, 2005 ... 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)). There is not a single MySQL function that does what you want, but you can use a combination of functions. Instead of concat('t',rand(1,4)), you might try this instead: >concat('t', truncate(4*rand()+1,0)) Quote Link to comment Share on other sites More sharing options...
D.Slatk Posted October 30, 2005 Author Share Posted October 30, 2005 (sorry for the slow reply) Thanks david for that code! It worked excellently! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.