Jump to content

Column question


Rune Thandy

Recommended Posts

I've got a table which goes something like this:

id	  usertext1	usertext2	usertext3	label1	 label2	 label3123	 12		   12A12345				  BPU		Charge124	 08B14501				  8			Charge				BPU.......

When I want to make a select statement I know which column has "Charge", but I don't know where "BPU" is. This can be in a different column each time.How can I make a select statement to find out in which column the "BPU" value is. Something like: select (something) where id='123'I want to fit it into a webpage, but I have to get the right select statement first.I pick up the "Charge" column from the page and want to set the first two digits from the accompanying column (e.g. label2/usertext2) in the column where the "BPU" is.This is probably not very clear, but it's a bit difficult to explain.So if you need further information to help me, please ask, because I really need some help here.

Link to comment
Share on other sites

You want to select the column `label1`?

SELECT COUNT( * ) AS `Rows` , `label1`FROM `(something)`GROUP BY `label1`ORDER BY `label1`

Would count how many things have label1. I wouldn't know how to do what you're doing though.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...