473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Tricky SQL query!

I am writing an application which produces labels for an overnight
Courier Company. In the mySQL database I have a field called 'NOP'
which records the 'number of pieces' for each consignment.

I have to produce one lable for each piece that is being shipped. The
label production module currently accepts an SQL query and prints one
label per returned row.

Does anyone know if it is possible to write a select query which would
produce a row based on the 'NOP' field? Imagine the following records

NOP Destination
--- -----------
1 London
1 Manchester
2 Glasgow

In this example, the Glasgow row would be repeated so that two labels
would be printed.

Any help appreciated.

Malc.
Jul 19 '05 #1
2 3396
On 2 Jan 2004 15:40:25 -0800, in mailing.database.mysql
mf*****@btinternet.com (Malc) wrote:
| I am writing an application which produces labels for an overnight
| Courier Company. In the mySQL database I have a field called 'NOP'
| which records the 'number of pieces' for each consignment.
|
| I have to produce one lable for each piece that is being shipped. The
| label production module currently accepts an SQL query and prints one
| label per returned row.
|
| Does anyone know if it is possible to write a select query which would
| produce a row based on the 'NOP' field? Imagine the following records
|
| NOP Destination
| --- -----------
| 1 London
| 1 Manchester
| 2 Glasgow
|
| In this example, the Glasgow row would be repeated so that two labels
| would be printed.
|
| Any help appreciated.
|
| Malc.


You shouldn't be looking at the SQL statements to do this work but the
routine(s) that print the actual label.

Read data from table
while NOT recordset.EOF
for counter = 1 to recordset.NOP_value
'--- print the label
next
get next record
close recordset
---------------------------------------------------------------
jn****@yourpantsbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 19 '05 #2
On 2 Jan 2004 15:40:25 -0800, in mailing.database.mysql
mf*****@btinternet.com (Malc) wrote:
| I am writing an application which produces labels for an overnight
| Courier Company. In the mySQL database I have a field called 'NOP'
| which records the 'number of pieces' for each consignment.
|
| I have to produce one lable for each piece that is being shipped. The
| label production module currently accepts an SQL query and prints one
| label per returned row.
|
| Does anyone know if it is possible to write a select query which would
| produce a row based on the 'NOP' field? Imagine the following records
|
| NOP Destination
| --- -----------
| 1 London
| 1 Manchester
| 2 Glasgow
|
| In this example, the Glasgow row would be repeated so that two labels
| would be printed.
|
| Any help appreciated.
|
| Malc.


You shouldn't be looking at the SQL statements to do this work but the
routine(s) that print the actual label.

Read data from table
while NOT recordset.EOF
for counter = 1 to recordset.NOP_value
'--- print the label
next
get next record
close recordset
---------------------------------------------------------------
jn****@yourpantsbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: dracolytch | last post by:
Good day all, Ok, I have a pretty tricky problem that I need some help with. I pass around search query information a fair amount (specifically WHERE statements). Normally, I just rawurlencode()...
5
by: scott | last post by:
Hello, I'm trying to find the most optimal way to perform a tricky query. I'm hoping this is some sort of standard problem that has been solved before, but I'm not finding anything too useful so...
3
by: Novice | last post by:
Hey all, I've attempted to simplify my question (or at least the XML that is part of my example in my question): I have the following XML: <A> <B><C><D> I want to query the data in this node...
1
by: Pea | last post by:
I'm working with a system usage database. I want to filter out repetitive logins. The query I have retrieves data like this: USER_DATE USER_TIME1 USER_USERID USER_ACCOUNT...
6
by: pointBoarder | last post by:
Thanks in advance to all who read this. I've got 3 tables which were created from a txt file dumped from some old system. Header ID -- autonumber, primary OrderNum -- field I want Line
5
by: ric_deez | last post by:
Hi there, I would like to create a simple search form to allow users to search for a job number based on a number of parameters. I think I understand how to use parameteres associated with Stored...
1
by: MorrganMail | last post by:
Or at least I find it tricky. :-) Assume we have three tables A, B and C. Table A contains a path and the distance for traveling that path: A (PathId, NodeId, Dist (from previous node)) 1, 1,...
15
by: edouard.spooner | last post by:
Hi, I have a tricky SQL query problem that I'm having probs with. I have a table which resembles something like this Date | Price1 | Price2 | Price3 01 Jan 2006 | 100 | 100 | 100 02 Jan...
0
by: hdogg | last post by:
I am using oracle with php. I am trying to accomplish a left outer join. Here are the 3 queries. Query 1, contains all the data on the left the will show up with data on the right. Query 1 =...
7
by: Whizzo | last post by:
Hi folks; Hope the example data below displays properly for you? CustName FireID CustID PolicyNo PolicyVal BuildingVal Claire Sheene 8 88221 125584 12,500 12,500...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.