Reputation: 203
From simple address table, if i select two columns, i am getting value of AddressLine1 but if i select single column, i am not getting value of AddressLine1.
Mysql query with two column: (Working fine)
select AddressLine1,AddressLine2 as v from address limit 10;
Mysql query with single column (Not Working)
select AddressLine1 as v from address limit 10;
For query output, please check attached image
Upvotes: 0
Views: 883
Reputation: 961
My best guess is that you are missing a way for MySQL to order your data for output, ie. a Primary key, thus you might be getting a different order of results everytime you run your query.
If your table has this structure:
ID (int), AddressLine1 (string), AddressLine(2)
then you can run your query SELECT AddressLine1 FROM address ORDER BY ID ASC limit 10;
Upvotes: 3